Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
How do I remove spaces from a string if I only want a single word? What is the method for doing it?
Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
Posted
If you want to extract a single letter from a word you can use "SubString". If you want to remove blank spaces then you can use "Trim"

Thanks & Regards,

zy_abc

Posted
i see, thanx, will try these out, very helpful indeed...
Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
Posted
yeah, it is, but i did not know before...
Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
  • 2 weeks later...
  • *Experts*
Posted

Or, yet another option, split up the trimmed text into words by

using the Split method, and then access the word in an array.

 

Dim s As String = "  this is a test   "
Dim words() As String

words = s.Trim().Split(" "c)

Console.WriteLine(words(1)) ' Displays "is"

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

In .Net if you use the built in functions created specifically for a class, you get better performance, and its also easier.

 

For those of you new to .net, just and an extra STOP charcater at the end of a variable, in this case you can do

 

strString = strString.Replace(" ","")

  • *Experts*
Posted

He means the period character. In other words, use the native

functions of the String class to perform string manipulation, rather

than the old VB6 methods.

 

For example, instead of myString = Trim(myString) (bad), use

myString = myString.Trim()

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...