Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jul 27, 2011 at 07:41 PM by Graham-Dunnett for the following reason:

Question is off-topic or not relevant - string.split is fully documented elsewhere

avatar image
0
Question by tomekkie2 · Jul 27, 2011 at 07:38 PM · string.split

One more String.Split question

I need to split a string as below:

var pname = lines[i].Split("x3C"[0])[1];

and I can not get the results I expect, no matter what I put instead of "0" in "[0]". This problem was discussed here many times, but in the cases I have found, the splitting string was always one character long.

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image almo · Jul 27, 2011 at 07:43 PM 0
Share

Graham beat me to posting a link to where it's documented. But he's right; it's not a Unity question.

avatar image tomekkie2 · Jul 27, 2011 at 07:53 PM 0
Share

I has been asked and answered a few times here anyway. I wouldn't ask if it was working as explained here: http://www.w3schools.com/jsref/jsref_split.asp

avatar image Bunny83 · Jul 27, 2011 at 09:10 PM 1
Share

That's the problem with you guys... You still don't realise that you don't work with browser JScript. UnityScript is a Javascript-syntax-based language but it is compiled with $$anonymous$$ono / .Net

string.Split can only split by a single char. You can't use a string as splitting delimiter. In Unityscript you can't define char-literals that's why you have to use a string and than grab the single char via index.

 "x3C"[0] == 'x'
 "x3C"[1] == '3'
 "x3C"[2] == 'C'
avatar image tomekkie2 · Jul 27, 2011 at 09:35 PM 0
Share

Great thanks, Bunny83

avatar image DaveA · Jul 27, 2011 at 09:44 PM 1
Share

You ARE dealing with something that's pretty well documented in the $$anonymous$$SDN. The function you want is documented here: http://msdn.microsoft.com/en-us/library/tabh47cf.aspx#Y500 That is, you can split a string by another string. Oddly, I don't see a simple 'string by A string' but 'string by array of strings' (like the one mentioned above is for an array of chars. I don't know how they program in Redmond, but most of us would be fine with a single string or char API.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to split a string using unity flash player? 0 Answers

Grab part of a string by looking for keyword 2 Answers

String.Split("¦"[0]) is not finding character 1 Answer

Parse String and Serialise 1 Answer

String Split all characters? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges