[Solved] how can i change String array to String [closed]

You can try the below code to convert string array to string public class JavaApplication20 { public static void main(String[] args) { // TODO code application logic here String test1 = “”; String[] test = {“this”,”this2″}; int length = test.length; //System.out.println(“Length :”+length); for(int i=0; i<length; i++){ //System.out.println(test[i]); test1 += test[i]+”,”; } int len = test1.length(); … Read more

[Solved] C# get position of a character from string

string aS = “ABCDEFGHI”; char ch=”C”; int idx = aS.IndexOf(ch); MessageBox.Show(string.Format(“{0} is in position {1} and between {2} and {3}”, ch.ToString(), idx + 1, aS[idx – 1], aS[idx + 1])); This wont handle if your character is at position zero and some other conditions, you’ll have to figure them out. 2 solved C# get position … Read more

[Solved] Why my strings are not going to be XOR?

Just another try on the code base of the question , #include<iostream> #include<string.h> using namespace std; int main() { string pass; string enc=”akdhigfohre”; string x = “”; string y = “”; cout<<“Enter new password: “; cin>>pass; cout<<“\n\nYour New Password is:” << pass<<endl; for(size_t i = 0; i < pass.size(); ++i){ x += pass.at(i)^enc.at(i%enc.size()); } cout<<“\n\nEncrypted … Read more

[Solved] both are char but i get, invalid conversion from `char’ to `char*’ [closed]

Not only are you confusing the order or parametres in strcpy (it’s destination, then source, so strcpy(xstring, animalsarray[j][0]); would have it’s parametres inverted), you’re confusing a char with a pointer-to-char. xstring is a char, and you’re trying to use it as a string. If you want to set all the elements of the array to … Read more

[Solved] How do I select the first, second, or third digit from a String containing three digits? [closed]

You could try this. String nbr = input.nextLine(); int a=nbr.charAt(0)-‘0’; int b=nbr.charAt(1)-‘0’; int c=nbr.charAt(2)-‘0’; Also, you could use substring and parse the result Using Integer.parseInt int a=Integer.parseInt(nbr.substring(0,1)); //Contains the leftmost digit 2 solved How do I select the first, second, or third digit from a String containing three digits? [closed]

[Solved] Please explain the output of this program based on pointers and strings?

Explanation line by line: Striker=Track; Sets Striker to point to the memory of Track, so Striker[0] would be equals to Track[0]. Track[1]+=30; Increases the value of the second index of Track by 30 (Track[1] = 50). cout<<“Striker >”<<*Striker<<endl; *Striker is the same as Striker[0], *Stirker+1 is the same as Striker[1] and so on. The output … Read more

[Solved] find numbers at string line c++

As mentioned in @Jhonny Mopp’s comment the primary problem is, that you don’t read a whole line here: cin>>line; it just reads up to the next whitespace delimiter. What you actually want is: getline(cin, line); This would read in the whole input until you hit Enter. Regarding the rest of processing refer to that Q&A … Read more