• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 146
  • Last Modified:

Finding spaces in a text string

How do I locate spaces in a text string then replace the spaces with a "+" sign?
0
charnal
Asked:
charnal
  • 2
1 Solution
 
manojaminCommented:
If Vb6 use

call Replace(yourstring, " ", "+")

if VB5

for i = 1 to len(mystring)
  if (mid(mystring, i, 1) = " ") then
      mid$(mystring, i, 1) = "+"
  end if
next
0
 
amit_panjwaniCommented:
 Dim Temp As MyString

  Temp = allTrim(MyString)

  Temp = Replace(Temp,Chr(32),"+")

  Do Until InStr(Temp," ") = 0
    Temp = Replace(Temp, Chr(32),"+")
  Loop

alternatively u can use "Split"  Function
0
 
amit_panjwaniCommented:
just take care of double spaces :)

lemme know :)
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now