Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #20301
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | David Lamb <dalamb@cs.queensu.ca> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Unicode escapes and String literals? |
| Date | Thu, 13 Dec 2012 16:21:47 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 32 |
| Message-ID | <kadgt6$862$1@dont-email.me> (permalink) |
| References | <kad3d6$eoo$1@dont-email.me> <kad4io$see$1@news2.informatik.uni-stuttgart.de> <kad7rb$btq$1@dont-email.me> <kadfh3$r6o$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Thu, 13 Dec 2012 21:21:45 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="7f42270a997e580902d19031af10867c"; logging-data="8386"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BNhSROIS7rdASg1kEHHlr" |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| In-Reply-To | <kadfh3$r6o$1@dont-email.me> |
| Cancel-Lock | sha1:xPQdsW9Di5J5v+rAJUN7tfqywwE= |
| Xref | csiph.com comp.lang.java.programmer:20301 |
Show key headers only | View raw
On 13/12/2012 3:58 PM, markspace wrote:
> On 12/13/2012 10:47 AM, Knute Johnson wrote:
>>
>> I want to be able to do it to a String not to a string literal.
>>
>
> Daniel showed one way to interpret your request. Here's another. Pay
> special attention to the bits out side the quotes. This program prints
> "fed".
>
>
> public class EscapeTest {
> public static void main(String[] args) {
> String \u0066\u0065\u0064 = "\u0066\u0065\u0064";
> System.out.println( fed );
> }
> }
Cute. But presupposing that the OP isn't the idiot some people seem to
have assumed, I suspect he meant something more like
String line = someBufferedFile.readline();
... change all \u escapes into unicode in "line" ... [1]
where by "\u escapes" he mean the 6-character substrings one usually
types in string literals. The OP needs to look into "code points" and
the corresponding codepoint to Character conversions at
http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html
[1] which, for the pedantic, really means "create a new string(buffer)
from line"
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