Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #20299
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe27.iad.POSTED!not-for-mail |
|---|---|
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Unicode escapes and String literals? |
| References | <kad3d6$eoo$1@dont-email.me> <Ggqys.16833$Sl.15694@newsfe27.iad> |
| In-Reply-To | <Ggqys.16833$Sl.15694@newsfe27.iad> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Lines | 31 |
| Message-ID | <fjqys.16834$Sl.8271@newsfe27.iad> (permalink) |
| X-Complaints-To | abuse@newsrazor.net |
| NNTP-Posting-Date | Thu, 13 Dec 2012 19:49:31 UTC |
| Date | Thu, 13 Dec 2012 11:49:31 -0800 |
| X-Received-Bytes | 2065 |
| Xref | csiph.com comp.lang.java.programmer:20299 |
Show key headers only | View raw
On 12/13/12 11:46 AM, Daniel Pitts wrote: > On 12/13/12 9:31 AM, Knute Johnson wrote: >> I just had a great revelation as I was putting together my SSCCE for the >> question I was going to ask. So it has changed my question. How do I >> do the conversion of unicode escape sequences to a String that are done >> by string literals? >> >> String s = "\u0066\u0065\u0064"; >> >> becomes "fed" but if you create a String with \u0066\u0065\u0064 in it >> without using the literal it stays \u0066\u0065\u0064. Is there a built >> in mechanism in Java for doing that translation to a String? >> > > Do you mean, you have a String, whose value is "\\u0066\\u0065\\u0064", > you want to pass that String to a method which will return fed. > > meaning > > String foo = "\\u0066\\u0065\\u0064"; > > System.out.println(foo); // prints \u0066\u0065\u0064 > System.out.println(magicFunction(foo)); // prints fed > > There might be such a function in Apache Commons library, but I don't > think there is one in the standard API. I could be wrong though. Two minutes of googling and reading a stack-overflow post gave me this link: <http://commons.apache.org/lang/api/org/apache/commons/lang3/StringEscapeUtils.html#unescapeJava%28java.lang.String%29>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unicode escapes and String literals? Knute Johnson <nospam@knutejohnson.com> - 2012-12-13 09:31 -0800
Re: Unicode escapes and String literals? Thomas Richter <thor@math.tu-berlin.de> - 2012-12-13 18:51 +0100
Re: Unicode escapes and String literals? Knute Johnson <nospam@knutejohnson.com> - 2012-12-13 10:47 -0800
Re: Unicode escapes and String literals? Lew <lewbloch@gmail.com> - 2012-12-13 11:41 -0800
Re: Unicode escapes and String literals? rossum <rossum48@coldmail.com> - 2012-12-14 13:32 +0000
Re: Unicode escapes and String literals? Lew <lewbloch@gmail.com> - 2012-12-14 15:16 -0800
Re: Unicode escapes and String literals? markspace <-@.> - 2012-12-13 12:58 -0800
Re: Unicode escapes and String literals? David Lamb <dalamb@cs.queensu.ca> - 2012-12-13 16:21 -0500
Re: Unicode escapes and String literals? markspace <-@.> - 2012-12-13 14:00 -0800
Re: Unicode escapes and String literals? David Lamb <dalamb@cs.queensu.ca> - 2012-12-13 17:17 -0500
Re: Unicode escapes and String literals? David Lamb <dalamb@cs.queensu.ca> - 2012-12-13 17:19 -0500
Re: Unicode escapes and String literals? Lew <lewbloch@gmail.com> - 2012-12-13 17:11 -0800
Re: Unicode escapes and String literals? Arne Vajhøj <arne@vajhoej.dk> - 2012-12-13 19:38 -0500
Re: Unicode escapes and String literals? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-12-13 11:46 -0800
Re: Unicode escapes and String literals? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-12-13 11:49 -0800
Re: Unicode escapes and String literals? Knute Johnson <nospam@knutejohnson.com> - 2012-12-13 14:55 -0800
Re: Unicode escapes and String literals? markspace <-@.> - 2012-12-13 15:32 -0800
Re: Unicode escapes and String literals? Arne Vajhøj <arne@vajhoej.dk> - 2012-12-13 18:09 -0500
Re: Unicode escapes and String literals? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-12-13 15:52 -0800
Re: Unicode escapes and String literals? Arne Vajhøj <arne@vajhoej.dk> - 2012-12-13 19:40 -0500
Re: Unicode escapes and String literals? Knute Johnson <nospam@knutejohnson.com> - 2012-12-13 16:11 -0800
Re: Unicode escapes and String literals? Arne Vajhøj <arne@vajhoej.dk> - 2012-12-13 19:43 -0500
Re: Unicode escapes and String literals? Knute Johnson <nospam@knutejohnson.com> - 2012-12-13 17:08 -0800
Re: Unicode escapes and String literals? Roedy Green <see_website@mindprod.com.invalid> - 2012-12-14 02:28 -0800
Re: Unicode escapes and String literals? Arne Vajhøj <arne@vajhoej.dk> - 2012-12-14 21:05 -0500
Re: Unicode escapes and String literals? Roedy Green <see_website@mindprod.com.invalid> - 2012-12-17 02:42 -0800
csiph-web