Results 1 to 5 of 5
  1. #1
    sarathuob is offline Member
    Join Date
    Jan 2013
    Location
    Cochin, india
    Posts
    2
    Rep Power
    0

    Unhappy Splitting a japanese sentense using colon

    [B]i want to split a japanese sentense using colon.. i can split a sentense which is having english before colon and japanese after that example (hello how are u :芝ダイレクト Yahoo!店") .. i can spliut this but i could not be able to split the below sentense .
    |||||||||||[PR]3日前にストアがつぶやきましたレビュー:1件評価:-ストア:東芝ダイレクト Yahoo!店"


    can any one help me to do this please .. this is the program i have tried

    import java.io.*;
    import java.net.URLDecoder;
    import java.net.URLEncoder;
    import java.util.regex.Pattern;

    public class SplitString {
    public static void main(String args[]) {
    try {
    String str = "|||||||||||[PR]3日前にストアがつぶやきましたレビュー:1件評価:-ストア:東芝ダイレクト Yahoo!店";
    String[] a, b;
    str = URLEncoder.encode(str, "UTF-8");
    a = str.split(":");
    //System.out.println(str);
    //System.out.println(URLEncoder.encode(":", "UTF-8"));
    // System.out.println(a[1]);
    for (int i = 0; i < a.length; i++) {

    System.out.println(URLDecoder.decode(a[i], "UTF-8"));
    // if(a[i].contains("//:")){
    // System.out.println("SPLIT:");
    // for(String s: a[i].split(":")){
    // System.out.println(s);
    // }
    // System.out.println("-----");
    // }

    }
    } catch (Exception e) {
    System.out.print(e);
    }

    }

    }

  2. #2
    viren2727in is offline Member
    Join Date
    Jan 2013
    Location
    INDIA
    Posts
    18
    Rep Power
    0

    Default Re: Splitting a japanese sentense using colon

    Quote Originally Posted by sarathuob View Post
    [B]i want to split a japanese sentense using colon.. i can split a sentense which is having english before colon and japanese after that example (hello how are u :芝ダイレクト Yahoo!店") .. i can spliut this but i could not be able to split the below sentense .
    |||||||||||[PR]3日前にストアがつぶやきましたレビュー:1件評価:-ストア:東芝ダイレクト Yahoo!店"


    can any one help me to do this please .. this is the program i have tried

    import java.io.*;
    import java.net.URLDecoder;
    import java.net.URLEncoder;
    import java.util.regex.Pattern;

    public class SplitString {
    public static void main(String args[]) {
    try {
    String str = "|||||||||||[PR]3日前にストアがつぶやきましたレビュー:1件評価:-ストア:東芝ダイレクト Yahoo!店";
    String[] a, b;
    str = URLEncoder.encode(str, "UTF-8");
    a = str.split(":");
    //System.out.println(str);
    //System.out.println(URLEncoder.encode(":", "UTF-8"));
    // System.out.println(a[1]);
    for (int i = 0; i < a.length; i++) {

    System.out.println(URLDecoder.decode(a[i], "UTF-8"));
    // if(a[i].contains("//:")){
    // System.out.println("SPLIT:");
    // for(String s: a[i].split(":")){
    // System.out.println(s);
    // }
    // System.out.println("-----");
    // }

    }
    } catch (Exception e) {
    System.out.print(e);
    }

    }

    }
    Hi sarathuob,
    [/CODE]
    public static void main(String args[]) {
    try {
    String str = "|||||||||||[PR]3日前にストアがつぶやきましたレビュー:1件評価:-ストア:東芝ダイレクト Yahoo!店";
    String[] a, b;
    a = str.split(":");
    System.out.println( a.length );
    for (int i = 0; i < a.length; i++) {

    System.out.println(URLDecoder.decode(a[i],"UTF8"));

    }
    } catch (Exception e) {
    System.out.print(e);
    }

    }
    [/CODE]

    Just save your .java file in UTF-8 format.
    Last edited by viren2727in; 01-23-2013 at 10:19 AM.

  3. #3
    viren2727in is offline Member
    Join Date
    Jan 2013
    Location
    INDIA
    Posts
    18
    Rep Power
    0

    Default Re: Splitting a japanese sentense using colon

    when you save your file in UTF-8 format there is no need for encoding and decoding.

    you can save your file in UTF-8 format using Eclispe, Edit Plus and many more editors.

    hope it helps you.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: Splitting a japanese sentense using colon

    Both of you, please go through Guide For New Members and BB Code List - Java Programming Forum - Learn Java Programming and edit your posts accordingly.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    sarathuob is offline Member
    Join Date
    Jan 2013
    Location
    Cochin, india
    Posts
    2
    Rep Power
    0

    Default Re: Splitting a japanese sentense using colon

    thank you very much viren.. it works for me .. :)

Similar Threads

  1. Japanese Input from Internet
    By Chris2547 in forum Networking
    Replies: 1
    Last Post: 11-17-2011, 02:06 AM
  2. Question mark colon operator question
    By orchid in forum Advanced Java
    Replies: 9
    Last Post: 12-19-2010, 08:49 AM
  3. japanese character in jsp page
    By javastuden in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 11-11-2010, 11:29 AM
  4. Displaying japanese and other charsets
    By Kkloe in forum Advanced Java
    Replies: 0
    Last Post: 10-03-2010, 08:36 PM
  5. [SOLVED] what does the colon means?
    By PureAwesomeness in forum New To Java
    Replies: 3
    Last Post: 02-04-2009, 05:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •