Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. [Support] Split function for handling text strings

[Support] Split function for handling text strings

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
6 Posts 2 Posters 179 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    wrote on last edited by Mr. Android
    #1

    There is some function to separate a certain text string based on a specific character, something like this:
    split ("String / dlkf / lkdf / ks", "/");

    For each "/" add me to an array

    TheHiddenHourundefined 1 Reply Last reply
    0
    • Kalitosundefined Kalitos

      There is some function to separate a certain text string based on a specific character, something like this:
      split ("String / dlkf / lkdf / ks", "/");

      For each "/" add me to an array

      TheHiddenHourundefined Offline
      TheHiddenHourundefined Offline
      TheHiddenHour
      Contributor
      wrote on last edited by
      #2

      Kalitos strTok(string, token) is what you're looking for. It returns an array of strings.

      For ex.
      strTok("test,string,here", ",") will return ["test", "string, here"]

      strTok("test;string;here", ";") will return ["test", "string", "here"]

      Kalitosundefined 1 Reply Last reply
      0
      • TheHiddenHourundefined TheHiddenHour

        Kalitos strTok(string, token) is what you're looking for. It returns an array of strings.

        For ex.
        strTok("test,string,here", ",") will return ["test", "string, here"]

        strTok("test;string;here", ";") will return ["test", "string", "here"]

        Kalitosundefined Offline
        Kalitosundefined Offline
        Kalitos
        wrote on last edited by
        #3

        TheHiddenHour excellent, just what I'm looking for, I thank you.
        Now, you know of some function that helps me to know if a certain word is inside an array that contains a word in each position.

        TheHiddenHourundefined 1 Reply Last reply
        0
        • Kalitosundefined Kalitos

          TheHiddenHour excellent, just what I'm looking for, I thank you.
          Now, you know of some function that helps me to know if a certain word is inside an array that contains a word in each position.

          TheHiddenHourundefined Offline
          TheHiddenHourundefined Offline
          TheHiddenHour
          Contributor
          wrote on last edited by
          #4

          Kalitos Can you be a bit more specific? If you want to know if an array contains a value, isInArray(array, value) should be able to do it.

          Kalitosundefined 1 Reply Last reply
          0
          • TheHiddenHourundefined TheHiddenHour

            Kalitos Can you be a bit more specific? If you want to know if an array contains a value, isInArray(array, value) should be able to do it.

            Kalitosundefined Offline
            Kalitosundefined Offline
            Kalitos
            wrote on last edited by Kalitos
            #5

            TheHiddenHour It is just what I need. Thank you.
            One last question.
            Is the syntax of this line correct?

            arratNewWeapon[array.size]=temp;
            

            Or it should be like this:

            arratNewWeapon[arratNewWeapon.size]=temp;
            
            TheHiddenHourundefined 1 Reply Last reply
            0
            • Kalitosundefined Kalitos

              TheHiddenHour It is just what I need. Thank you.
              One last question.
              Is the syntax of this line correct?

              arratNewWeapon[array.size]=temp;
              

              Or it should be like this:

              arratNewWeapon[arratNewWeapon.size]=temp;
              
              TheHiddenHourundefined Offline
              TheHiddenHourundefined Offline
              TheHiddenHour
              Contributor
              wrote on last edited by
              #6

              Kalitos The second one is correct.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Donate