• Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse

Plutonium

[Support] Split function for handling text strings

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
6 Posts 2 Posters 43 Views
    • 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
  • TheHiddenHourundefined Offline
    TheHiddenHourundefined Offline
    TheHiddenHour Contributor
    replied to Kalitos 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
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to TheHiddenHour 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
  • TheHiddenHourundefined Offline
    TheHiddenHourundefined Offline
    TheHiddenHour Contributor
    replied to Kalitos 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
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to TheHiddenHour 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
  • TheHiddenHourundefined Offline
    TheHiddenHourundefined Offline
    TheHiddenHour Contributor
    replied to Kalitos on last edited by
    #6

    Kalitos The second one is correct.

    1 Reply Last reply
    0

  • Login

  • Don't have an account? Register

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

  • Don't have an account? Register

  • Login or register to search.