Skip to content
  • 0 Unread 0
  • 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 539 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.
  • Kalitos Offline
    Kalitos 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

    TheHiddenHour 1 Reply Last reply
    0
    • Kalitos 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

      TheHiddenHour Offline
      TheHiddenHour 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"]

      Kalitos 1 Reply Last reply
      0
      • TheHiddenHour 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"]

        Kalitos Offline
        Kalitos 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.

        TheHiddenHour 1 Reply Last reply
        0
        • Kalitos 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.

          TheHiddenHour Offline
          TheHiddenHour 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.

          Kalitos 1 Reply Last reply
          0
          • TheHiddenHour 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.

            Kalitos Offline
            Kalitos 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;
            
            TheHiddenHour 1 Reply Last reply
            0
            • Kalitos 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;
              
              TheHiddenHour Offline
              TheHiddenHour Offline
              TheHiddenHour
              Contributor
              wrote on last edited by
              #6

              Kalitos The second one is correct.

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              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
              • Unread 0
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Donate