Announcement

Collapse
No announcement yet.

How to split text in a text field without a delimiter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to split text in a text field without a delimiter

    I need to split a text field with numbers and put then in different value fields. There is no delimiter in the numbers.
    For example: 789
    7
    8
    9

    Thanks in advance!!

  • #2
    Hi,

    Find split_text_without_delimiter.via file example scene attached.

    Splitting means a delimiter is used, In this case we are retrieving the characters by index in the string. GetChar(0) = the first character

    I used the GetChar method that can be found under "string" category in script doc for further elaboration.

    Regards
    Attached Files

    Comment


    • #3
      Hi Novacane,

      I should have mentioned it was for template wizard. Will this principle work for TW as well?

      Comment


      • #4
        Hi Shotski,

        Okay so this is in Viz script. But if you put a "control text" plugin on the master font with the script. It will give you a single field in Template Wizard. And on the graphic it will push the 3 characters to their seperate fonts. I will upload a VTW template for you tomorrow which does the same thing using Viz template wizard text boxes.

        Regards

        Comment


        • #5
          The data comes in as a single string so i look forward to your TW example. Thanks again
          Last edited by Shotski2; 02-24-2021, 03:58 PM.

          Comment


          • #6
            The vtw script looks like that:
            Code:
            Sub splitBtnClick(Sender)
                outputMemeo.Lines.Clear
                for i = 1 to Len(inputField.Text)
                    outputMemeo.Lines.Add mid( inputField.Text, i, 1)
                next
            End sub
            Attached Files

            Comment


            • #7
              Here is a download link:
              http://www.mediafire.com/folder/x7jbghf1zu574/templates
              I see I cannot upload vtw or rar files here anymore.

              On the download link you will find a Template Wizard Template you can import. It is using the "Mid" function , I see adishin also sent that one here.

              I used it under the OnTextChange event for ease of use.

              *Thanks for the tip lars, I swopped from Firefox to Chrome and am still facing the same issue though. strange
              Last edited by Novacane89; 02-26-2021, 08:30 AM.

              Comment


              • #8
                I had just had the same problem when using Brave browser, I could load when switching to chrome

                Originally Posted by Novacane89 View Post
                Here is a download link:
                http://www.mediafire.com/folder/x7jbghf1zu574/templates
                I see I cannot upload vtw or rar files anymore.

                On the download link you will find a Template Wizard Template you can import. It is using the "Mid" function , I see adishin also sent that one here.

                Comment


                • #9
                  Or use the Mod function to split a number..

                  Mod10.PNG

                  Comment


                  • #10
                    Wow, thanks everyone. So many ways to do the same thing. So grateful for you all!!!!!

                    Comment


                    • #11
                      Another solution that is similar to what Novacane proposed.
                      DumbString = DumbNumber.UTF8Text

                      if CL_Number.Value = 3 then

                      N1_F.Value = CInt(Mid(DumbString,1,1))
                      N2_F.Value = CInt(Mid(DumbString,2,1))
                      N3_F.Value = CInt(Mid(DumbString,3,1))

                      end if
                      End Sub
                      Last edited by Shotski2; 02-26-2021, 04:57 PM.

                      Comment

                      Working...
                      X