answersLogoWhite

0

How do you convert char to string?

User Avatar

Anonymous

13y ago
Updated: 8/19/2019

Character.toString('c')

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How do you convert char to String in java?

A String is nothing but a bunch of characters one after the other whereas a character has a size of only '1' So converting a string into a char is not possible. what you can do is form a character based on only one element from the string. Ex: String name = "Rocky"; char xyz = name.charAt(0); now the char xyz will have one character from the String.


C prog to concatenate two string without using buid in function?

//String Concatination#include#includeusing namespace std;char* strcat(char*,char*);int main(){char str1[100];char str2[100];coutstr1;coutstr2;cout


Write a program in c to convert a given string to lower case?

Use the tolower() function. Example: char* a = 'X'; a = tolower(a); printf("%c", a);


C plus plus programs - to replace every space in a string with a hyphen?

char *string = "this is a test"; char *p; for (p=string; *p!='\0'; p++) if (*p==' ') *p='-';


What is the difference between string and char array?

3 differences.................. 1. length wise.... 2.initialization 3. null terminated length of char array is differ from string........ initialization of string is differ from char....... and string is null terminated...........


Write a function for concatnating the string s1 s2 and storing the result in string s3?

char *strmerge (char *s3, const char *s1, const char *s2) { strcpy (s3, s1); strcat (s3, s2); return s3; }


Convertion of upper case char in a string to lower case and vice versa?

You can use the methods toUpperCase & toLowerCase to convert Strings to any case you want.


How do you convert char array into unsigned char array in c?

You can't convert the data type of any variable.


Why does C forbid converting a string constant to 'char' ?

C forbids converting a string constant to 'char' because string constants are stored in read-only memory, and attempting to modify them through a 'char' pointer can lead to undefined behavior and potential program crashes.


What is the different between char and string?

char is used in Java to enetr only one character but string is used to specify a whole sentence or a bunch of characters.


How do you reverse a string in C?

Code example:/* ******************************************************************************** * FUNCTION: cpReverseStr ******************************************************************************** * DESCRIPTION: * Reverses a given string. Overwrites original. * * PARAMETERS: * cpString: The string to reverse. * * RETURNS: * Reversed string. ******************************************************************************** */ char * cpReverseStr( char *cpString) { register char cTmp; register char *cpFirst = cpString; register char *cpLast = cpFirst + strlen(cpString) - 1; while(cpFirst < cpLast) { cTmp = *cpFirst; *cpFirst = *cpLast; *cpLast = cTmp; cpFirst++; cpLast--; } return cpString; }


What is the difference between Char a equals string and char a equals String?

Well, if you write like char a=string; it is wrong. You have to declare the size of the array or else put the brackets immediately after the variable declaration. You also have to put the string in quotes, or provide a comma-separated list of characters. E.g.,char a[]={'s','t','r','i','n','g'};Or more simply:char a[] = "string";Remember that C/C++ is case-sensitive and that all keywords are lower case. Thus Char would be regarded as an invalid keyword.