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...

21 Jul at 02:39

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 `志...

3 Sep at 15:38

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 ...

8 Jan at 17:27

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...

23 May at 12:34

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 ...

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...

11 Jan at 20:59

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?

11 Apr at 15:56

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...

1 Oct at 20:5

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 `\` ...

20 Dec at 13:52

Converting a char to uppercase

Converting a char to uppercase how would i get the F and L variables converted to uppercase.

15 Apr at 12:5

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...

24 Nov at 08:31

How do I apply the for-each loop to every character in a String?

How do I apply the for-each loop to every character in a String? So I want to iterate for each character in a string. So I thought: but I get a compiler error: How can I do this?

23 Feb at 22:49

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...

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: ...

23 May at 10:28

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...

4 Nov at 18:11

"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...

20 Jun at 09:12

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...

26 May at 22:8

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...

9 Feb at 17:36

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?

25 Nov at 00:12

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...

17 Feb at 16:9

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...

13 Jan at 11:48

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+'"...

13 Mar at 17:22

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...

16 Feb at 09:55

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...

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 ...

10 Jan at 08:31