Questions tagged [chars]

a datatype that can hold a character of the implementation’s character set.

208 questions
0
votes
2 answers

How to remove repeated chars from string but with exceptions like 'good' or 'cool'?

I'm trying to remove repeated chars from strings like I looooovvee this. It's awesomee. Very gooood. to an output like: I love this. It's awesome, Very good. I'm already using in PHP this instrunction $str=preg_replace("/(.)\1+/", "$1", $str); But…
0
votes
2 answers

How do I scan into a 2d char array without scanning in the enter/space chars?

So I have to make a maze program, and to start I must scan in the maze to a 2d array. The problem arises when i go to put the chars into the array, when the enter char and the space char always take up the first slot in the array... Here is my…
AaronFye
  • 11
  • 5
0
votes
1 answer

fscanf from two different files

During an assignment in school I came across this phenomenon which I cannot understand. My task was to read two files and check wether they are exactly the same. I made two text files which contained the exact same line: "Hello world" I decided to…
HazirBot
  • 323
  • 2
  • 14
0
votes
4 answers

What is the best and effective way to read chars from string in java

I want to know the effective way of reading a string which does not affect memory nor performance of the program. I have the following implementation: String x = "RED123........"; char[] xh =…
BelieveToLive
  • 281
  • 1
  • 4
  • 18
0
votes
1 answer

Regex matching order numbers e.g DE + 10 numbers or AT +10 numbers

I'm actually trying to match some order numbers in a string. The string could look like this: SDSFwsfcwqrewrPL0000018604ergerzergdsfa or FwsfcwqrewrAT0000018604ergerzergdsfaD and I need to match the "PL0000018604" or "AT0000018604". Actually I'm…
DeeKaay
  • 3
  • 1
0
votes
4 answers

How to check user input with if command

Not sure if I'm overlooking something really simple but I'm trying to make a program that allows a user to enter 1 of 2 letters and then run code based on the input. Seems simple enough but I've run into several errors with all the ways I thought…
0
votes
2 answers

Get the characters from a list of lists

I have this example : example=[["hello i am adolf","hi my name is "],["this is a test","i like to play"]] So , I want to get the following array: chars2=[['h', 'e', 'l', 'l', 'o', ' ', 'i', ' ', 'a', 'm', ' ', 'a', 'd', 'o', 'l', 'f','h', 'i', ' ',…
John
  • 9
  • 2
0
votes
0 answers

Find all files in directory which has ^@ control M in it

I have 200 odd file in a directory. Many files have ^@^@^@^@^@^@^@^@ characters in it. I have to first find all the files which have these special characters and list it. Then take a back up of those files and delete the special characters in those…
manasa
  • 1
  • 1
0
votes
1 answer

Reading text file and breaking it by delimiters

I am trying to read a text file with the following structure: Item 1 - 50, Item 2 - 400, Item 3 - 120, Item 4 - 15; and while looping over the file, I want to store the price and the item name in two strings. To make it more clear, I have int…
Donoven Rally
  • 1,670
  • 2
  • 17
  • 34
0
votes
1 answer

how to split a string to several Strings by Specified number of characters in java

I have a hypothetical string with 2500 characters. (myString.length=2500) and I want to split it to several strings per 500 chars and assign this new strings to an Array string.
Sadeq Shajary
  • 427
  • 6
  • 17
0
votes
1 answer

Python: Insert two sets of chars into a matrix

Working with the Playfair cipher. I have two sets of chars: a keyword and the rest of the alphabet without the characters within the keyword. Example (Due to the nature of the Playfair cipher, 'i' is not taken into account to work with 25…
kaozbender
  • 95
  • 3
  • 8
0
votes
2 answers

Trying to pass a string as an argument for a class but it is being recognized as an array of chars instead in C++

I am having problems initializing Warrior Objects in my main function The code for my Warrior Class is below class Warrior{ public: Warrior(const string& input_name, int& input_strength) :name(input_name), strength(input_strength) {}; string…
0
votes
1 answer

Extract multiple substrings before / after certain chars

I'm looking to get multiple certain substrings before and after certain chars...e.g.: "Capacity : Less than 10 litres |Power : Up to 1400 W|Type of surface : Carpets and rugs" I need to get these in 2 lists of strings (or datatable or something…
Eoiner
  • 161
  • 4
  • 13
0
votes
2 answers

Lines 21,23,24,26,29 subscripted value is neither array nor pointer nor vector

Its a code to convert lowercase chars in a vector to uppercase chars. Im getting error in lines 21,23,24,26,29. Im newbie programing in C. Please help me. int main() { char orig[30]; char dest[30]; printf("Write a string :"); …
Fran
  • 1
  • 1
0
votes
1 answer

How to separate unique characters from several words in a "indic" text file?

I've a plain text file. > Input: इंजेक्शन इंटरनॅशनल इंटिग्रेटेड इंटिरिअर इंडस्ट्री All words are separated by one or more spaces. I want to collect all unique chars from the text file. I'm looking for a unix command; the order of the result chars…
user1
  • 4,031
  • 8
  • 37
  • 66