The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Simulators >> Circuit Simulators >> String trim in SKILL https://designers-guide.org/forum/YaBB.pl?num=1169549241 Message started by adesign on Jan 23rd, 2007, 2:47am |
Title: String trim in SKILL Post by adesign on Jan 23rd, 2007, 2:47am Could you please let me know if there is any way to trim a string in SKILL? e.g. Given string is ABCDEFG, MNOPEFG, IJKLEFG, WXYZEFG I want ABCD, MNOP, IJKL, WXYZ and trim out EFG from the above. Any suggestions............... |
Title: Re: String trim in SKILL Post by Geoffrey_Coram on Jan 23rd, 2007, 6:12am The hard way would be to use parseString and buildString, ie result = buildString( parseString( "MNOPEFG", "EFG")) |
Title: Re: String trim in SKILL Post by bernd on Jan 23rd, 2007, 9:21am If you're sure that the string have always this character index 1234567 ABCDEFG 12345678 MNOPEFG you can also use substring( "MNOPEFG" 1 4 ) Bernd |
Title: Re: String trim in SKILL Post by bernd on Jan 23rd, 2007, 9:30am Or very blown up, if you know that "EFG" were always the 3 last characters. t_myString = "MNOPEFG" t_result = substring( t_myString 1 length( parseString( t_myString "" ) ) - 3 ) |
Title: Re: String trim in SKILL Post by adesign on Jan 23rd, 2007, 11:22pm Thank you all for the help!! |
Title: Re: String trim in SKILL Post by adesign on Jan 24th, 2007, 2:22am Here is one more improved version: rexCompile("EFG$") ; pattern meaning EFG at end of string ($ means end of string) rexReplace("ABCDEFG" "" 1) ; replace first occurrence of pattern with blank. Regards, |
Title: Re: String trim in SKILL Post by Andrew Beckett on Jan 24th, 2007, 2:16pm Aw, you could have credited me ;) Your last append looks remarkably like http://www.cdnusers.org/Forums/tabid/52/view/topic/postid/3057/forumid/62/tpage/1/Default.aspx#3072 ... (I don't mind really, honest) Andrew. |
Title: Re: String trim in SKILL Post by adesign on Jan 24th, 2007, 10:21pm Yes Andrew, It is taken from there only!!! |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |