How do you call String.replace(char oldChar, char newChar) ?

117 views
Skip to first unread message

Sebastien Diot

unread,
Jan 4, 2014, 7:27:36 AM1/4/14
to xtend...@googlegroups.com
I'd like to use String.replace(char oldChar, char newChar), but in Xtend, there is no different syntax to characters and Strings, so if I do:

text.replace('.','_')

The code actually calls:

replace(CharSequence target, CharSequence replacement)

because it has the same name.

Sebastian Zarnekow

unread,
Jan 4, 2014, 7:32:41 AM1/4/14
to xtend...@googlegroups.com
You may want to follow this ticket: https://bugs.eclipse.org/bugs/show_bug.cgi?id=412383

For now, you'll have to use a local var for the character:

val char lookup = '.'
val char replacement = '_'
text.replace(lookup, replacement)

Regards,
Sebastian

--
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

signature.asc
Reply all
Reply to author
Forward
0 new messages