Showing posts with label whitespace. Show all posts
Showing posts with label whitespace. Show all posts

Saturday, March 31, 2012

trim

How do I trim a value that has whitespace after the last character?
ie
<Value>123456 </Value
thanks
markif you merely use Trim(value)
or myVar.Trim
--
this will assure you have no white space at either end
Hi,

TryString.Trim Method

HTH

trim and pure apparently whitespace strings

has anyone encountered an apparently pure whitespace string (debug mode
mouse-over) that when TRIM'd does not result in a null-string ?

how to determine any special characters that may be present in the string ?trimming a string with just spaces will return an empty string ("") not a
null string (null)...

The easiest way to evaluate the string would be to write it to disk. Create
a file and write the string out, then analyse the file in a hex editor to
check for excape characters.

"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:eFtfjQG0EHA.1264@.TK2MSFTNGP12.phx.gbl...
> has anyone encountered an apparently pure whitespace string (debug mode
> mouse-over) that when TRIM'd does not result in a null-string ?
> how to determine any special characters that may be present in the string
> ?
i was using "null-string" in the traditional sense of a reference to a
String datatype object that consists of 0 characters -- not a
"null-reference" (a reference to Nothing)

actually, i found this very useful function for discovering hidden
characters in a string:

Uri.HexEscape()

"Dan Bass" <danielbass [at] postmaster [dot] co [dot] uk> wrote in message
news:OAfw44H0EHA.2600@.TK2MSFTNGP09.phx.gbl...
> trimming a string with just spaces will return an empty string ("") not a
> null string (null)...
> The easiest way to evaluate the string would be to write it to disk.
Create
> a file and write the string out, then analyse the file in a hex editor to
> check for excape characters.
>
> "John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
> news:eFtfjQG0EHA.1264@.TK2MSFTNGP12.phx.gbl...
> > has anyone encountered an apparently pure whitespace string (debug mode
> > mouse-over) that when TRIM'd does not result in a null-string ?
> > how to determine any special characters that may be present in the
string
> > ?

trim and pure apparently whitespace strings

has anyone encountered an apparently pure whitespace string (debug mode
mouse-over) that when TRIM'd does not result in a null-string ?
how to determine any special characters that may be present in the string ?trimming a string with just spaces will return an empty string ("") not a
null string (null)...
The easiest way to evaluate the string would be to write it to disk. Create
a file and write the string out, then analyse the file in a hex editor to
check for excape characters.
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:eFtfjQG0EHA.1264@.TK2MSFTNGP12.phx.gbl...
> has anyone encountered an apparently pure whitespace string (debug mode
> mouse-over) that when TRIM'd does not result in a null-string ?
> how to determine any special characters that may be present in the string
> ?
>
i was using "null-string" in the traditional sense of a reference to a
String datatype object that consists of 0 characters -- not a
"null-reference" (a reference to Nothing)
actually, i found this very useful function for discovering hidden
characters in a string:
Uri.HexEscape()
"Dan Bass" <danielbass [at] postmaster [dot] co [dot] uk> wrote in message
news:OAfw44H0EHA.2600@.TK2MSFTNGP09.phx.gbl...
> trimming a string with just spaces will return an empty string ("") not a
> null string (null)...
> The easiest way to evaluate the string would be to write it to disk.
Create
> a file and write the string out, then analyse the file in a hex editor to
> check for excape characters.
>
> "John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
> news:eFtfjQG0EHA.1264@.TK2MSFTNGP12.phx.gbl...
string
>

Trim whitespace (start and end) of string

Just wondering how you can trim the whitespace of a string for the start and end of it.


e.g. " My String "

Thanks!

nothing more then string.trim(); put the string value in a string variable.

greets,

Erdem


Here are the methods available to you

publicstring Trim(paramschar[] trimChars);

publicstring Trim();

publicstring TrimStart(paramschar[] trimChars);

publicstring TrimEnd(paramschar[] trimChars);


Hi,

try this

String myString = " My String ";

myString.Trim(' ');

Regards