a datatype that can hold a character of the implementation’s character set.
Questions tagged [chars]
208 questions
35
votes
3 answers
How to validate text isn't blank in Rails
if I do
validates :body, :presence => true, :length => {:maximum => 30000, :message => ' is a bit long...'}
validates :body, :length => {:minimum => 10, :message => ' is a bit short...'}
I still have a possibility of having a text which…

Nick Ginanto
- 31,090
- 47
- 134
- 244
11
votes
8 answers
significance of negative values of type char in C
chars in 'C' are used to represent characters.
Numbers representing characters in all code pages are always positive.
What is the use of having signed characters?? Are negative values contained in chars used only as integral values in a smaller…

Abhijith Madhav
- 2,748
- 5
- 33
- 44
9
votes
2 answers
How can I create an efficient iterator of chars from stdin with Rust?
Now that the Read::chars iterator has been officially deprecated, what is the the proper way to obtain an iterator over the chars coming from a Reader like stdin without reading the entire stream into memory?

maxcountryman
- 1,562
- 1
- 24
- 51
9
votes
1 answer
Are Java String Objects an Array of Chars?
I am new to java and trying to understand the essentials and fundamentals of the language.
Is it accurate to state that Java string objects are intrinsically a class defined as an immutable array of chars?
I ask this as I'm a bit confused by the…

Edward J Beckett
- 5,061
- 1
- 41
- 41
6
votes
4 answers
JQuery load() and national letters(like ę,ą,ć)
I'm using JQuery load() method to load content to page. The only problem is, when content is loaded via load() method all national(polish) chars are displaying invalid... On both pages loaded and main(in which content is load) coding is set to…

f1ames
- 1,714
- 1
- 19
- 36
6
votes
3 answers
SQL Server: Replace characters different than a char in a string using no temporary table
I have a NVARCHAR(10) column in a table. It can store any type of UNICODE strings.
I want to replace every char which is different than '1' with '0'.
Let's say I have the string '012345C18*'. I should get '0100000100'.
I managed to do it using a…

darkdante
- 707
- 1
- 17
- 36
6
votes
3 answers
Return a pointer to a char array in C
I've seen a lot of questions on that on StackOverflow, but reading the answers did not clear that up for me, probably because I'm a total newbie in C programming. Here's the code:
#include
char* squeeze(char s[], char c);
main()
{
…

orion3
- 9,797
- 14
- 67
- 93
6
votes
2 answers
List of chars to string in Emacs Lisp
I have a list of characters (?h ?e ?l ?l ?o) and i want to convert it to string "hello". Currently i use this structure:
(concat (mapcar (lambda (ch) (char-to-string ch)) s))
Is there a more elegant and idiomatic way to convert list of chars to a…

Mirzhan Irkegulov
- 17,660
- 12
- 105
- 166
6
votes
3 answers
Stuck with boolean always returning TRUE
hello i'm new at the java world and i stuck in my code and it would be really nice a litle hel p
im having a problem with a bolean at this code/
public class Variables {
boolean bit;
String name;
public Variables(int b, String name){
…

willian ver valem
- 385
- 4
- 20
5
votes
5 answers
Turn NumPy Array of characters into a string
I have a numpy array of characters and when I write it to file it writes as:
['K' 'R' 'K' 'P' 'T' 'T' 'K' 'T' 'K' 'R' 'G' 'L']
I want it to write with just the letters and without the brackets or quotations i.e. as:
KRKPTTKTKRGL
I have looked at…

aatakan
- 83
- 1
- 5
5
votes
3 answers
Comparing chars in a character array with strcmp
I have read an xml file into a char [] and am trying to compare each element in that array with certain chars, such as "<" and ">". The char array "test" is just an array of one element and contains the character to be compared (i had to do it like…

Isawpalmetto
- 785
- 3
- 12
- 18
5
votes
1 answer
using DocumentFilter.replace with unicode characters
I am building a GUI where one textfield must be typed in latin characters, the others in arabic. To avoid switching the keyboard layout, I choosed to maintain it in arabic and use a DocumentFilter in that particular textfield to replace arabic…

Brahim Gaabab
- 310
- 3
- 9
4
votes
4 answers
Read 2 letters in a string using JAVA
I need to write a Java program that reads a string and determines if there are these two letters: the lowercase letter “e” or “d”.
That's what i written so far! any ideas why this doesn't work?
class ex2 {
public static void main(String[] args)…

noel293
- 514
- 5
- 21
4
votes
3 answers
Get unused chars in string?
I am really new to Programming and I just started and learned some basics for C#. I just tried to write a method that checks if some special chars are NOT included in a string. My result is this code:
static string GetUnused(string s)
{
/*
…

Tomas Wilson
- 147
- 2
- 7
4
votes
6 answers
Why it's bad to provide an implicit operator of String(char[])?
We can:
var t=new String(new[] { '繁', '體', '中', '文' });
or
var encoding=Encoding.Unicode;
var bytes=encoding.GetBytes(new[] { 'E', 'n', 'g', 'l', 'i', 's', 'h' });
var t=encoding.GetString(bytes);
Without sometning like:
public static implicit…

Ken Kin
- 4,503
- 3
- 38
- 76