3

Suppose to be a easy one

I get a compiler error for this:

var str:String = "117\/7024"

I gauss i have a problem with either / but i cant find an answer how to correct this String

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
Michael A
  • 5,770
  • 16
  • 75
  • 127
  • Apple's Swft book explains in detail what characters you can and can't put into a String literal. – gnasher729 Jul 08 '15 at 09:03
  • Your code was not rendered correctly in the initial version of the question . Is this what you actually meant? – Martin R Jul 08 '15 at 09:05

1 Answers1

3

Looks like you are trying to re-define str which you might have defined before yourself. I would not recommend this type of variable name, even if it is legal.

Also, you need to leave a space after the =.

EDIT: Your original question quoted the string as "117/7024", which does not give this error. I suppose you meant to write "117\7024".

To escape a backslash, use "117\\7024".
To actually get the unicode character "瀤", use "177\u{7024}".

Mundi
  • 79,884
  • 17
  • 117
  • 140
  • Yes, I but based on the previous version of the question I assumed the OP defined it himself before. – Mundi Jul 08 '15 at 09:07