string.copyValueOf()

String.copyValueOf() copy chars from an array of chars to create a string
Syntax
String1.copyValueOf(String2, int offset, int count)
offset (optional ) : starting point of copying chars
count (optional ) : Number of chars from starting point to be copied.

offset and count both are to be given ( not one ).

The output is string

Here are some examples with output.
char[] my_str1= {'p','l','u','s','2','n','e','t'};
String my_str2="";
my_str2=my_str2.copyValueOf(my_str1,0,4); 
System.out.println(my_str2);  // plus
my_str2=my_str2.copyValueOf(my_str1,2,4); 
System.out.println(my_str2);  // us2n
my_str2=my_str2.copyValueOf(my_str1,5,3); 
System.out.println(my_str2);  // net 
my_str2=my_str2.copyValueOf(my_str1); 
System.out.println(my_str2);  // plus2net


All String functions

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer