char Questions
3
Solved
Just out of curiousity (not really expecting a measurable result) which of the following codes are better in case of performance?
private void ReplaceChar(ref string replaceMe) {
if (replaceMe.Co...
Farl asked 20/4, 2016 at 8:22
7
Solved
I have a for loop in Java.
for (Legform ld : data)
{
System.out.println(ld.getSymbol());
}
The output of the above for loop is
Pad
CaD
CaD
CaD
Now my question is it possible t...
3
Solved
Given a fixed-length char array such as:
let s: [char; 5] = ['h', 'e', 'l', 'l', 'o'];
How do I obtain a &str?
5
Solved
I feel like this is a really silly question, but I can't seem to find an answer anywhere!
Is it possible to get a group of chars from a char array? to throw down some pseudo-code:
char arry[20] =...
45
Solved
A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction.
To check whether a word is a palindrome I get the char array of the word and co...
Jochbed asked 9/11, 2010 at 21:28
23
I have read this question to get first char of the string. Is there a way to get the first n number of characters from a string in C#?
4
I have an application where I accept a socket connection from a telnet client and put up a simple, keyboard driven character GUI.
The telnet client, at least on Linux, defaults into line-at-a-time...
19
Solved
I want to convert a std::string into a char* or char[] data type.
std::string str = "string";
char* chr = str;
Results in: “error: cannot convert ‘std::string’ to ‘char’ ...”.
What methods are ...
7
Solved
I want to compare two strings. Is it possible with strcmp? (I tried and it does not seem to work). Is string::compare a solution?
Other than this, is there a way to compare a string to a char?
...
Sinclair asked 30/3, 2011 at 21:13
10
Solved
In Java, what would the fastest way to iterate over all the chars in a String, this:
String str = "a really, really long string";
for (int i = 0, n = str.length(); i < n; i++) {
char c = str.c...
Emelia asked 17/1, 2012 at 12:2
3
Solved
8
Solved
I'm wondering what the correct way to compare two characters ignoring case that will work for all cultures. Also, is Comparer<char>.Default the best way to test two characters without ignorin...
Kvass asked 8/9, 2009 at 16:13
5
Solved
I am trying to update a text field in a table of my postgresql database.
UPDATE public.table SET long_text = 'First Line' + CHAR(10) + 'Second line.' WHERE id = 19;
My intended result is that th...
Waddle asked 29/10, 2014 at 19:7
5
Solved
I'm doing an assignment where we have to read a series of strings from a file into an array. I have to call a cipher algorithm on the array (cipher transposes 2D arrays). So, at first I put all the...
9
Solved
Using GDB, I find I get a segmentation fault when I attempt this operation:
strcat(string,&currentChar);
Given that string is initialized as
char * string = "";
and currentChar is
char c...
Goatsbeard asked 29/1, 2011 at 2:48
14
I have a char and I need a String. How do I convert from one to the other?
Jute asked 17/11, 2011 at 18:37
5
Solved
Consider the following code:
#include <iostream>
#include <type_traits>
int main()
{
std::cout << "std::is_same<int, int>::value = " << std::is_same<i...
Scarify asked 12/5, 2013 at 1:38
13
Solved
I have a java string, which has a variable length.
I need to put the piece "<br>" into the string, say each 10 characters.
For example this is my string:
`this is my string which I need ...
2
Solved
Does C++23 now provide support for Unicode characters in its basic char type, and to what degree?
So on cppreference for character literals, a character literal:
'c-char'
is defined as either:
...
Crescendo asked 6/9, 2023 at 20:46
11
Solved
While practicing Java I randomly came up with this:
class test
{
public static void main(String arg[])
{
char x='A';
x=x+1;
System.out.println(x);
}
}
I thought it will throw an error beca...
7
Solved
char out_file_name[30];
ogSize = strlen(FileName); //i.e. - FileName_anylength.log (always.log)
ogSize -= strlen(IN_FILE_SUFFIX); //amount of chars before .log
strncpy( out_file_name, FileName,...
10
Solved
9
Solved
Could smb please explaing the process of sorting characters of String alphabetically? For example, if I have String "hello" the output should be "ehllo" but my code is doing it wrong.
public stati...
5
Solved
Starting from
char tval[20] = "temp:26.62";
how can I add a space character until tval is filled? I need that in the end to obtain this:
char tval[20] = "temp:26.62 ";
5
I find myself often using variables that contain a very small range of numbers (typically from 1 to 10) and would like to minimize the amount of memory I use by using the char data type instead of ...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.