Welcome to DirectSmile

Script for splitting firstname into 2 frames

link this post written on 01/10/2013
  • To top

Looking for a quick script to split a firstname only into 2 frames. Would like 4 characters in the first frame and the rest in the second frame. And if the firstname has 4 or less characters all goes in the first frame and nothing in the second frame.

Any help would be great. Thanks.

link this post written on 04/10/2013
  • To top

Hi Lizbeth,

Here is hopefully what you like

 

function lizbeth()
     inputText = RS("IncomingText")
     textLength = Len(inputText)
     If textLength > 4 Then
          firstFrame = Left(inputText,4)
          secondFrame = Right(inputText, textLength -4)
          lizbeth = firstFrame +"\#" + secondFrame
     Else
          lizbeth = inputText +"\#" +""
     End If
End function

 

Best regards,

NOG

link this post written on 11/10/2013
  • To top

Thank you NOG, for the much faster response and the well working script.

Here in addition from me.

 

Also working is:

function outTxt()

    inTxt = RS("IncomingText")

    outTxt = Left(inTxt, 4) & "\#" & Mid(inTxt, 5)

End function

 

Or possible as a formula:

Left(RS("IncomingText"), 4) & "\#" & Mid(RS("IncomingText"), 5)

 

The Left, Mid and Right functions simply give back an empty string in case a defined position (>0) is empty, so it works without further control.

 

Regards

Wolfgang

The author has edited this post (on 11/10/2013)
  • Statistics: 3 Posts | 21 Visits
created by mixxt
  • v1.1.1
  • (highfive)