|
|
removing leading character from left,right a string
Hello,
I need to remove a space on the right and left of a string
name =3D " =F4 "
#line 5
for (ix1=3D1;ix1<2;ix1++) getline ;
name=3Dsubstr($0,0,52)
name1=3Dgsub(/^ *| *$/, "",name)
In dos editor the space equal that character according to the font
used : " " That is my code above but useless .
|
|
0
|
|
|
|
Reply
|
ehabaziz2001 (345)
|
11/4/2007 9:18:24 PM |
|
On 11/4/2007 3:18 PM, happytoday wrote:
> Hello,
> I need to remove a space on the right and left of a string
> name =3D " =F4 "
> #line 5
> for (ix1=3D1;ix1<2;ix1++) getline ;
> name=3Dsubstr($0,0,52)
Whatever the above is trying to do, using "getline" is almost certainy th=
e wrong
approach. Provide more info if you'd like help on doing it the right way.=
> name1=3Dgsub(/^ *| *$/, "",name)
>=20
> In dos editor the space equal that character according to the font
> used : " " That is my code above but useless .
>=20
gsub() doesn't return a string. You just need to use a character class:
gsub(/^[[:space:]]*|[[:space:]]*$/,"",name)
Regards,
Ed.
|
|
0
|
|
|
|
Reply
|
Ed
|
11/4/2007 11:33:55 PM
|
|
|
1 Replies
924 Views
(page loaded in 0.116 seconds)
Similiar Articles: removing leading character from left,right a string - comp.lang ...Hello, I need to remove a space on the right and left of a string name =3D " =F4 " #line 5 f... How to remove characters from a string - comp.soft-sys.matlab ...removing leading character from left,right a string - comp.lang ... Hello, I need to remove ... non ASCII characters - comp.lang.awk How to remove characters from a string ... Remove character at end of text string - comp.databases.filemaker ...removing leading character from left,right a string - comp.lang ... Remove a text string from a worksheet ... String: Extract characters from the ... Remove first and last 3 characters of a string - comp.soft-sys.sas ...removing leading character from left,right a string - comp.lang ..... the last character by using Right(Text, 1) and removing it ... Remove any leading and trailing ... How to remove the first 5 characters from a string? - comp.unix ...removing leading character from left,right a string - comp.lang ..... comp.lang.rexx Also, extracting the first two characters from the left in a string can ... Deleting Characters from a String Variable - comp.soft-sys.stat ...removing leading character from left,right a string - comp.lang ... Deleting Characters from a String Variable - comp.soft-sys.stat ... removing leading character from ... filling left side of string - comp.lang.awkremoving leading character from left,right a string - comp.lang ... filling left side of string - comp.lang.awk removing leading character from left,right a string - comp ... Add the character ' to a string - comp.soft-sys.matlabremoving leading character from left,right a string - comp.lang ... Make the number into a string, count characters, concatenate "0"s to the left until full ... How to remove "\n" character - comp.lang.awkremoving leading character from left,right a string - comp.lang ... Deleting the first n characters of a field - comp.lang.awk ... How to remove characters from a string ... Convert string : Upper to lower - comp.unix.solarisremoving leading character from left,right a string - comp.lang ... Convert string : Upper to lower - comp.unix.solaris... each "word" into lower case with a leading upper ... removing leading character from left,right a string - comp.lang ...Hello, I need to remove a space on the right and left of a string name =3D " =F4 " #line 5 f... Automate Excel ยป VBA: Remove Characters from Left or Right Side ...VBA: Remove Characters from Left or Right Side of Variable Length String 7/23/2012 8:40:02 AM
|
|
|
|
|
|
|
|
|