#1
|
|||
|
|||
string
hi!
two questions about string: -i would like lo translate a number in a string, which command sholud I use? -i need to search inside a string another one using "jolly" characters like ? e *. is it possible? how? thank you!!!!!!!!!!!!!!!!!!!! |
#2
|
||||
|
||||
Re: string
First one is easy --> LET Abc (STR 14.234) returns a string
opposite is LET Xyz (VAL "12.123") Second one --> don't know abaout it. Maybe it helps to use a combination of 'POS', 'SUBSTR', '=' ? |
#3
|
||||
|
||||
Re: string
I've never heard the expression "jolly" characters, but I'm guessing it is the same as "wildcard" characters, meaning a character which can represent any character(s) in a search string. It comes from wildcards in poker which can used as any card in the deck. The ? can be any single character, and * can be one or more characters.
The only macro command I know of for searching strings is the POS command which Michael mentioned. I ran a quick test and it does not support the standard wildcard characters ? or *, it treats them as a standard character. The Programming Help for POS does not mention support for any wildcard characters. As Michael indicated, it might be possible to write a custom macro which can do it, but I don't think there is a standard command or macro which does it.
__________________
John Scheffel |
#4
|
||||
|
||||
Re: string
As what Michael and John suggested, to search substring within a string, I normally use the POS command as below. Wildcard does not seem to be allowed. However, wildcard is allowed in infotext operations.
PHP Code:
Last edited by Lim Chee Beng; 11-23-2005 at 05:24 PM. |
#5
|
|||
|
|||
Re: string
Thank you!
It's true... wildcard are not allowed. i tried yesterday and it didn't work.If you try, you can also name a part using ? and * characters...it's allowed! So...i'm gonna writing a macro for it. Thank you again! |
#6
|
|||
|
|||
Re: string
There is a way of using wildcards against text - take a look at "FIND_AND_REPLACE" here: http://www.cocreateusers.org/macros/macro.htm
|
#7
|
||||
|
||||
Re: string
Hi,
Please have a look at the command MATCH Code:
Returns 1 if the first string is matched by the pattern specified by the second string, otherwise returns 0. The pattern may contain wildcards as follows: * Matches any string including the null string. ? Matches any single character. [...] Matches any one of the enclosed characters. A pair of characters separated by a hyphen (-) matches any character lexically between the pair, inclusive. A NOT operator, !, can be specified immediately following the left bracket to match any single character not enclosed in the brackets. \ Removes any special meaning of the following character. Any other character matches itself. John
__________________
High performance CAD workstations Please visit us at https://www.cadware.nl |
#8
|
||||
|
||||
Re: string
Wow, great, yes, really - still things to learn for CoCreate people as well ;-)
The command to use is MATCH: MATCH string string ===> number Returns 1 if the first string is matched by the pattern specified by the second string, otherwise returns 0. The pattern may contain wildcards as follows: * Matches any string including the null string. ? Matches any single character. [...] Matches any one of the enclosed characters. A pair of characters separated by a hyphen (-) matches any character lexically between the pair, inclusive. A NOT operator, !, can be specified immediately following the left bracket to match any single character not enclosed in the brackets. \ Removes any special meaning of the following character. Any other character matches itself. |
#9
|
|||
|
|||
Re: string
Thank you!!!!!!!!!!!!!!!!!!!!!!!!
It's really great! So now I don't have to loose time to write a custom macro for it! thank you very much!! |
#10
|
||||
|
||||
Re: string
Yet another macro command I wasn't aware of and have never used. This is what makes reading these forums worthwhile, every week I learn something new. It even seems to support a tiny bit of the regular expression syntax with the brackets.
__________________
John Scheffel |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|