96

Вопрос по character, arrays, java, string – Преобразование строки в массив символов в Java

Error: User Rate Limit ExceededStringError: User Rate Limit ExceededсимволError: User Rate Limit ExceededtoCharArray()Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • ArrayUtilsError: User Rate Limit Exceededcommons-langError: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • chaining is always bestError: User Rate Limit Exceeded

    от
  • Error: User Rate Limit ExceededcharError: User Rate Limit ExceededCharacterError: User Rate Limit ExceededCharacter.valueOf(mychar)Error: User Rate Limit Exceeded

    от ee.
  • Error: User Rate Limit Exceeded

    от Eric Hartford
  • Error: User Rate Limit Exceeded

    от barsju
  • Error: User Rate Limit Exceeded

    от blackcompe
12 ответов
  • 1

    Error: User Rate Limit Exceeded

    String str="I am a good boy";
        char[] chars=str.toCharArray();
    
        Character[] characters=new Character[chars.length];
        for (int i = 0; i < chars.length; i++) {
            characters[i]=chars[i];
            System.out.println(chars[i]);
        }
    

  • 0

    Error: User Rate Limit Exceeded

    String str = "somethingPutHere";
    Character[] c = ArrayUtils.toObject(str.toCharArray());
    

  • 164

    Error: User Rate Limit Exceeded

    String str = "testString";
    char[] charArray = str.toCharArray();
    Character[] charObjectArray = ArrayUtils.toObject(charArray);
    

  • 2

    Error: User Rate Limit Exceeded

    charAt(i)Character[]arrayname[i] = string.charAt[i].

  • 0

    Error: User Rate Limit Exceeded

    public JTextField display;
    String number=e.getActionCommand();
    
    display.setText(display.getText()+number);
    
    ch=number.toCharArray();
    for( int i=0; i<ch.length; i++)
        System.out.println("in array a1= "+ch[i]);
    

  • 0

    Error: User Rate Limit Exceeded

    StringReaderjava.ioread(char[] cbuf)

    String str = "hello";
    char[] array = new char[str.length()];
    StringReader read = new StringReader(str);
    
    try {
        read.read(array); //Reads string into the array. Throws IOException
    } catch (IOException e) {
        e.printStackTrace();
    }
    
    for (int i = 0; i < str.length(); i++) {
            System.out.println("array["+i+"] = "+array[i]);
    }
    

    array[0] = h
    array[1] = e
    array[2] = l
    array[3] = l
    array[4] = o
    

  • 49

    Error: User Rate Limit Exceeded

    :

    String str = "testString";
    
    //[t, e, s, t, S, t, r, i, n, g]
    Character[] charObjectArray = 
        str.chars().mapToObj(c -> (char)c).toArray(Character[]::new); 
    

    get an IntStream of the characters (you may want to also look at codePoints()) map each 'character' value to Character (you need to cast to actually say that its really a char, and then Java will box it automatically to Character) get the resulting array by calling toArray()

  • 2

    String#toCharArrayError: User Rate Limit ExceededcharError: User Rate Limit ExceededCharacterError: User Rate Limit ExceededcharError: User Rate Limit ExceededCharacterError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceededchar[]).

  • 4

    Error: User Rate Limit Exceeded

    String s="Welcome to Java Programming";
    char arr[]=s.toCharArray();
    for(int i=0;i<arr.length;i++){
        System.out.println("Data at ["+i+"]="+arr[i]);
    }
    

    Data at [0]=W
    Data at [1]=e
    Data at [2]=l
    Data at [3]=c
    Data at [4]=o
    Data at [5]=m
    Data at [6]=e
    Data at [7]= 
    Data at [8]=t
    Data at [9]=o
    Data at [10]= 
    Data at [11]=J
    Data at [12]=a
    Data at [13]=v
    Data at [14]=a
    Data at [15]= 
    Data at [16]=P
    Data at [17]=r
    Data at [18]=o
    Data at [19]=g
    Data at [20]=r
    Data at [21]=a
    Data at [22]=m
    Data at [23]=m
    Data at [24]=i
    Data at [25]=n
    Data at [26]=g
    

  • 0

    Error: User Rate Limit Exceeded

    public static Character[] convertStringToCharacterArray(String str) {
        if (str == null || str.isEmpty()) {
            return null;
        }
        char[] c = str.toCharArray();
        final int len = c.length;
        int counter = 0;
        final Character[] result = new Character[len];
        while (len > counter) {
            for (char ch : c) {
                result[counter++] = ch;
            }
        }
        return result;
    }
    

  • 2

    Error: User Rate Limit Exceeded

    /**
     * @param sourceString
     *            :String as argument
     * @return CharcterArray
     */
    public static Character[] toCharacterArray(String sourceString) {
        char[] charArrays = new char[sourceString.length()];
        charArrays = sourceString.toCharArray();
        Character[] characterArray = new Character[charArrays.length];
        for (int i = 0; i < charArrays.length; i++) {
            characterArray[i] = charArrays[i];
        }
        return characterArray;
    }
    

  • 32

    Error: User Rate Limit Exceeded

    public Character[] toCharacterArray( String s ) {
    
       if ( s == null ) {
         return null;
       }
    
       int len = s.length();
       Character[] array = new Character[len];
       for (int i = 0; i < len ; i++) {
          array[i] = new Character(s.charAt(i));
       }
    
       return array;
    }