» Home » character » Page 1
How do I read character by character from a text file and put it in a character array?
Category : Programming Languages

I'm trying to read character by character from a text file until EOF, put them into a character array, so that I can manipulate it after. Compiled with g++ without errors, and when run, I'm prompted for the input file but then it just hangs.

int main (int argc, char *argv[]) {
string filename;
ifstream infile;
char *cp, c[1024];
memset (c, 0,

View Replies

regex to match a character only if not followed by another character, then replace just that initial character
Category : Programming Languages

does that title make sense?

For instance, (/=[^>]/, '═')
I'd like to keep that match, but only replace the equals sign with the double-horizontal-line. As it is, it matches any '=' that is followed by anything that isn't a '>' but then replaces both the '=' and the following character with the replacing character, I want to keep the following character, but replace just the

View Replies

Android. Replace a character with a character from numeric character reference
Category : Programming Languages

I often read such messages. But what is the reason of the replacement? I only know that a space bar cannot be at the end of a string because it will be ignored and you will get the string without the space bar.

<string name="lorem">Lorem and a space bar&#160;</string>

But what about everything else? I don't see any visual difference between

View Replies

Remove character from a string if previous character is a specified character
Category : Programming Languages

If I have a string like this :

asdasda=1lsdn=sdf=3dfsdf=-sadf= adfgh=1fbfg=fgfg

what is the fastest way to remove a character if 1) it comes after an = and 2) that character is a non alphabet.

In this case the o/p of the function will be :


I am coding in c++.


View Replies

How to get the length of a string containing character references while counting the character references as one single character?
Category : Programming Languages

How can I get the length of string that also contains character references? I want to count only the number of characters which will be displayed in the browser. Like

$raw = "Stack&#00f9" = Length = 6
$raw = "Stack12345" = Length = 10
$raw = "Stack&#00f9&#00f9" = Length = 7

Thanks in advance

View Replies

Prevent unidentified character in ActiveSupport::Inflector.transliterate being replaced by ? (or the replacement character)
Category : Programming Languages

The documentation of ActiveSupport::Inflector.transliterate states:

Replaces non-ASCII characters with an ASCII approximation, or if none exists, a replacement character which defaults to "?".

I want that the characters for which approximations are not available, remain as it is. e.g.


View Replies

Java: I want to read from a file, character by character, and save each char into an array that has a max size of 10
Category : Programming Languages

this is my code:

//array way
char [] name = new char[10];
firstName = input.next();
for(int j = 0; j < name.length(); j++){
name [j] = name.charAt(j);
for(int i = 0; i < name.length; i++){

View Replies

Restricting a special character in a text and allowing the same character only after a comma using Regular expression
Category : Programming Languages

My text should start with $ and then can contain only alphabets A-Z, no special character is allowed, now there can be a COMMA (,) and again the same pattern will repeat i.e. $ and alphabets.

How do I create a regular expression for such condition?

View Replies

How to search for a character in a string and output the index of every place that character appears? (Javascript)
Category : Web Design

I figured it out, thank you. I need to move the body to the html. Changed some tags in the body section.

window.alert ("You entered an invalid character (" + enterLetter + ") please re-enter");
View Replies

Java Getting an ASCII character set from a font and drawing each character seperately on a white background?
Category : Development Tools & Services

Basically, I'm looking for a way to draw 255 images (ASCII character set) of a specific font. I would like each character to be drawn on a black background (white letter), and the image shouldn't be any bigger than the size of the character. Would be very appreciative towards any help. Thanks.

View Replies

2012 / 2017 Copyrights BigHow , All Rights Reserved .