DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete CRLF / CR in a String - (got the String from Excel)

Solved!
Go to solution

Hey 🙂

 

i have a Excel Sheet where i save some information for the Script.

 

in the past i had one information each field - so it was not problem to geht the information by

 

MyString = myProjekt.Cells(DataRow,1).Value

 

 

 

to bring more options in to my script, i decide to seperate the information in one field by unsing ";" an write it in a new line (same field)

 

diademexcel.png

 

 

the string i get in Diadem is

 

"Info1 ; Info2 ; info3"

 

 

but after each ; must be a CRLF oder CR oder a other functional character.

 

I will seperate my information by using

 

X = Split(MyString, ";", -1, vbTextCompare)

 

 

the command "trim" delete the space, but not the functional one

--> X(1) = "Info1"

--> X(2) = " Info2"

--> X(3) = " Info3"

 

In front of Info2 and 3 there is the functional character i did not get out of it.

 

 

Has someone a idea how to solve my problem?

 

thank you! have a nice weekend 😉

 

 

 

 

 

0 Kudos
Message 1 of 3
(5,192 Views)
Solution
Accepted by topic author MaikThierer

Hi Malik,

 

The VBScript function you're looking for is Replace(), and you can pass it vbCRLF or vbCR or vbLF or just " ".  You can also call the function multiple times if you have multiple ASCII chararacters you want to remove, such as:

 

MyStr = Replace(MyStr, vbCRLF, "")

MyStr = Replace(MyStr, " ", "")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 3
(5,163 Views)

Hey Brad_Turpin,

 

wow great - thank you   Smiley Happy

 

the Replace() command i still tried in my tests last week, but my fault was the command for CRLF -> vbCRLF

 

greets

maik

 

0 Kudos
Message 3 of 3
(5,149 Views)