Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
Beginners / Re: StrToInt conversion problem
« Last post by JLWest on Today at 01:14:12 am »

Trim is not procedure, but function, that is Trim(Bit); will do nothing.
But
Code: Pascal  [Select]
  1. Bit := Trim(Bit);
will actually do what you want.

That did it.

Changed:

 Trim(Bit);    to    Bit  :=  Trim(Bit);

AAA, PAJN , PANC , B734_ASA , 0000 , ASA7731 , ASA199 , 0 < Actual text line

   Bit := ExtractWord(5,LineIn, [',']);

So the statement ExtractWord(5,LineIn, [',']); is picking up a space. Must  be before or after the 0000 field.

Thanks
   

2
General / Re: Console in/output utf in lazarus 2.0.0
« Last post by benohb on Today at 12:55:07 am »

@Bart It is linux

http://wiki.freepascal.org/Lazarus_with_FPC3.0_without_UTF-8_mode#Problem_System_encoding_and_Console_encoding_.28Windows.29

Code: Pascal  [Select]
  1. Console output codepage: 0
  2. System codepage: 65001
  3. ????????


SetTextCodePage(Output, 65001);



Code: Pascal  [Select]
  1. Console output codepage: 65001
  2. System codepage: 65001
  3. ????????
  4.  


Nothing has changed
Also I can not use the debugger with the external xtrem ..  There is also a problem
3
Beginners / Re: StrToInt conversion problem
« Last post by Zoran on Today at 12:54:47 am »

Trim is not procedure, but function, that is Trim(Bit); will do nothing.
But
Code: Pascal  [Select]
  1. Bit := Trim(Bit);
will actually do what you want.
4
Beginners / Re: StrToInt conversion problem
« Last post by JLWest on Today at 12:44:15 am »
memo1.append(inttostr(strtoint(ExtractWord(5,LineIn, [' ']))));

works for me but it appears you have two spaces in your set of WordDelims.

Davo


Here is the actual lines of code from the program.

//   AAA, PAJN , PANC , B734_ASA , 0020 , ASA7731 , ASA199 , 0 < Actual text line

   Bit := ExtractWord(5,LineIn, [',']);
   Trim(Bit);
   BitNbr := StrToInt(Bit);         <--- Error on this line '0000' not a valid integer
 
5
I realized it was a request to have some parts of the build mode apply to each project by default.


Might have to make use of macros, too.  [size=78%]http://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames[/size]
You're right, making it happen automatically and by default is the "trick" that's eluded me so far.

I feel the way you do, I have a strong feeling it is possible using macros but, I haven't gotten it right. 

For that reason, I figured I'd ask those who obviously know a lot more about the Lazarus environment than I do.

ETA:

@Lucamar,  thank you for trying. 

At least I'm not feeling quite as "inadequate" as when I posted the question.
6
Might have to make use of macros, too. http://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames

Unfortunately macros don't seem to work for the exe name. At least in my experience...

I tried to make something similar to what the OP wants by using macros ... and ended up with executables named: $(ProjDir) and alike  >:D
7
Beginners / Re: Strings and special characters removal
« Last post by garlar27 on February 15, 2019, 11:55:10 pm »
I saw a IsLetter in the unit Character but it looks like it works with UTF16 ....
 :-\
8
Beginners / Re: Strings and special characters removal
« Last post by lucamar on February 15, 2019, 11:45:43 pm »
But this will not tell you if this multi-byte char IS or IS NOT a "letter" because it includes punctuation and other symbols.
Does anyone know how to know if it is a letter or something else?

Sure: Get the codepoint and test against all known "letter" codepoints  ;)
There must be a function somewhere which does it already, IsAlpha() or something alike, but I don't remember where it is. Let me check ...

(later) I haven't found (yet) anything as simple as a IsUnicodeAlpha() function but there are some things it the unicodedata unit (in {fpc-source}/rtl/objpas/unicodedata.pas) that may be useful to implement one.
9
General / Re: How to control output exe name and location in Lazarus with build modes ?
« Last post by ASBzone on February 15, 2019, 11:35:50 pm »
Select a build mode and then set path and executable name?

Bart


That was my initial read of the inquiry, and then I realized it was a request to have some parts of the build mode apply to each project by default.


Might have to make use of macros, too.  [size=78%]http://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames[/size]
10
Beginners / Re: Strings and special characters removal
« Last post by garlar27 on February 15, 2019, 11:34:42 pm »
I've been looking at this http://wiki.freepascal.org/UTF8_strings_and_characters#The_beauty_of_UTF-8 and it allows you to know when you are dealing with a multi-byte char.

Now you know that
Code: Pascal  [Select]
  1. case AnAscciiChar of
  2.    000..127: OneByteChar;
  3.    128..191: TwoByteChar;
  4.    192..223: ThreeByteChar;
  5.    224..255: FourByteChar;
  6. end;
  7.  
I would do something like this:
Code: Pascal  [Select]
  1.    ALength := Length(AStr);
  2.    ind := 1;
  3.    while ind <= ALength do begin
  4.       AChar := AStr[ind];
  5.       case AChar of
  6.          000..127: IncCount := 1;
  7.          128..191: IncCount := 2;
  8.          192..223: IncCount := 3;
  9.          224..255: IncCount := 4;
  10.       end;
  11.       TheRealChar := Copy(AStr, ind, IncCount);
  12.       ProcessTheRealChar(TheRealChar);
  13.  
  14.       Inc(ind, IncCount);
  15.    end;
  16.  
But this will not tell you if this multi-byte char IS or IS NOT a "letter" because it includes punctuation and other symbols.
Does anyone know how to know if it is a letter or something else?
Pages: [1] 2 3 ... 10