Board index » cppbuilder » Re: Convert AnsiString to integer
b
![]() CBuilder Developer |
b
![]() CBuilder Developer |
Re: Convert AnsiString to integer2003-07-07 08:10:13 AM cppbuilder70 tnx "nicolasr" <nicolasrNOSPAMATSIGNgmx.net>ha scritto nel messaggio QuoteIf I understand correctly you need conversion from AnsiString to int? |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2003-07-07 09:58:38 AM
Re:Re: Convert AnsiString to integer
"nicolasr" <nicolasrNOSPAMATSIGNgmx.net>wrote in message
Quoteboth will throw an exception if the AnsiString Gambit |
Thorsten Kettner
![]() CBuilder Developer |
2003-07-07 02:06:11 PM
Re:Re: Convert AnsiString to integer
"nicolasr" <nicolasrNOSPAMATSIGNgmx.net>wrote:
Quoteint i = StrToInt(s); {smallsort} |
JD
![]() CBuilder Developer |
2003-07-07 04:30:33 PM
Re:Re: Convert AnsiString to integer
"Thorsten Kettner" < XXXX@XXXXX.COM >wrote:
Quote
string is '1a'. The first unrecognized character ends the conversion. int i = atoi( s.c_str() ); ~ JD |
nicolasr
![]() CBuilder Developer |
2003-07-08 07:27:33 AM
Re:Re: Convert AnsiString to integer
Hi,
I tried your code and got the error "'21' is not a valid component name" (translated from german) Looking at the VCL sources I found that the name property is validated by a function called IsValidIdent. The following comment precedes the declaration of this function: { IsValidIdent returns true if the given string is a valid identifier. An identifier is defined as a character from the set ['A'..'Z', 'a'..'z', '_'] followed by zero or more characters from the set ['A'..'Z', 'a'..'z', '0..'9', '_']. } So how about using names like CB1, CB2 or similar? Or assign your numerical identifier to the Tag property instead of the name. hope this helps, Nick |