tagged [char]
Java Replace Character At Specific Position Of String?
Java Replace Character At Specific Position Of String? I am trying to replace a character at a specific position of a string. For example: replace string position #2 (i) to another letter "k" How woul...
In C#, how can I detect if a character is a non-ASCII character?
In C#, how can I detect if a character is a non-ASCII character? I would like to check, in C#, if a char contains a non-ASCII character. What is the best way to check for special characters such as `志...
Why we can't have "char" enum types
Why we can't have "char" enum types I want to know why we can't have "char" as underlying enum type. As we have byte,sbyte,int,uint,long,ulong,short,ushort as underlying enum type. Second what is the ...
How to get the first five character of a String
How to get the first five character of a String I have read this [question to get first char](https://stackoverflow.com/q/3878820/1716774) of the string. Is there a way to get the first n number of ch...
How to convert const char* to char* in C?
How to convert const char* to char* in C? In my project there is a method which only returns a `const char*`, whereas I need a `char*` string, as the API doesn't accept `const char*`. Any idea how to ...
- Modified
- 11 Mar at 14:7
Incrementation of char
Incrementation of char I found some question asking how to let char 'B' to return 'C' and then 'D' etc. The answers were quite complex and mostly just overkill. Why not to use simply this: EDIT: It go...
How to convert a char array back to a string?
How to convert a char array back to a string? I have a char array: My current solution is to do But surely there is a better way of doing this?
What is the simplest way to convert char[] to/from tchar[] in C/C++(ms)?
What is the simplest way to convert char[] to/from tchar[] in C/C++(ms)? This seems like a pretty softball question, but I always have a hard time looking up this function because there seem there are...
Illegal Escape Character "\"
Illegal Escape Character "\" I want to get the name at the end of a link so I did that Eclipse said String literal is not properly closed by a double-quote How can I compare String with this char `\` ...
Converting a char to uppercase
Converting a char to uppercase how would i get the F and L variables converted to uppercase.
When to use malloc for char pointers
When to use malloc for char pointers I'm specifically focused on when to use malloc on char pointers Would a malloc be in order for something as trivial as this? If yes, why? If not, then when is it n...
C# adding a character in a string
C# adding a character in a string I know I can append to a string but I want to be able to add a specific character after every 5 characters within the string from this string alpha = abcdefghijklmnop...
- Modified
- 9 Feb at 11:48
How to make function return string in c++
How to make function return string in c++ > [How to convert this code to use string](https://stackoverflow.com/questions/3792736/how-to-convert-this-code-to-use-string) I have a function like this: ...
How to generate a random String in Java
How to generate a random String in Java I have an object called `Student`, and it has `studentName`, `studentId`, `studentAddress`, etc. For the `studentId`, I have to generate random string consist o...
"Too many characters in character literal error"
"Too many characters in character literal error" I'm struggling with a piece of code and getting the error: > Too many characters in character literal error Using C# and switch statement to iterate th...
How to represent the double quotes character (") in regex?
How to represent the double quotes character (") in regex? I need to use regex, to check if a string starts with a character (`"`) and ends with a character too. The problem is I can't use a character...
Find the first character in a string that is a letter
Find the first character in a string that is a letter I am trying to figure out how to look through a string, find the first character that is a letter and then delete from that index point and on. Fo...
Best way to check if a character array is empty
Best way to check if a character array is empty Which is the most reliable way to check if a character array is empty? or or do i need to do Whats the most efficient way to go about this?
How to check the last character of a string in C#?
How to check the last character of a string in C#? I want to find the last character of a string in C# and then put it in an `if` statement. Then if the last character is equal to 'A', 'B' or 'C' a ce...
Why is char[] preferred over String for passwords?
Why is char[] preferred over String for passwords? In Swing, the password field has a `getPassword()` (returns `char[]`) method instead of the usual `getText()` (returns `String`) method. Similarly, I...
cannot convert 'std::basic_string<char>' to 'const char*' for argument '1' to 'int system(const char*)'
cannot convert 'std::basic_string' to 'const char*' for argument '1' to 'int system(const char*)' I get this error: "invalid operands of types 'const char*' and 'const char [6]' to binary 'operator+'"...
Append x occurrences of a character to a string in C#
Append x occurrences of a character to a string in C# What is the best/recommended way to add x number of occurrences of a character to a string e.g. The header variable needs to have, let's say a hun...
C# - How to convert string to char?
C# - How to convert string to char? I am a beginner in C# and I would like to know how to convert strings to chars, specifically `string[]` to `char[]`. I tried `ToCharArray()`, but I then I got an er...
- Modified
- 26 Nov at 20:42
How can I retrieve Enum from char value?
How can I retrieve Enum from char value? I have the following enum In one function I have for exp: `'S'` , and I need to have `MaritalStatus.Single`. How can I ? For string I found this solution, but ...