Questions tagged as 'string'

2
answers

Create an object of type Stream from a string

I need to create an object of type System.IO.Stream from the contents of a string . This my string is in a Resource.resx file. I retrieve it like this: string xml = ResourcesRel.pt_BR; I need to use a component that ha...
asked by 22.02.2017 / 20:00
2
answers

Checking if a string is empty in JavaScript. Idiomatic or readable?

I understand that it is often best to appreciate the legibility and clarity of code by programming explicitly. This does not stop at JavaScript, but also at C # , Python and perhaps the rest of the programming languages. I know these conv...
asked by 23.09.2017 / 12:27
3
answers

How to concatenate string with null without explicitly verifying?

When I try to concatenate a String that is actually null with a valid string (eg "a"), I get the value nulla . See the example below: String a = "a"; String b = null; System.out.println(b + a); I wanted the output to be just...
asked by 29.06.2016 / 22:45
2
answers

Regular expression to find numbers in the middle of words

I'm currently developing a project that I'm using regular expressions to find certain patterns, however there is a specific String and I need to extract two numbers from this, the expression is like this: Agência: 0000 Conta: 00000-0...
asked by 27.02.2018 / 19:28
2
answers

Is there a method in Python similar to x.find (string), but does it return all occurrences?

For example, I have a string with multiple occurrences of a : a = 'abcdefhanmakaoa' If I use the find method, I can only find the index of the first occurrence. Is there a native method / function that returns all occurrences?...
asked by 02.12.2018 / 13:44
3
answers

Can not implicitly convert type 'object' to 'int'. An explicit conversion exists (are you missing a cast?)

I'm trying to develop code in my game but I'm having this error. ... case "cpsuser": Console.Write("Digite o apelido do usuário: "); string Nickname = Console.ReadLine(); Console.Write("Digite a quantidade de Cupons"); stri...
asked by 18.05.2016 / 16:26
4
answers

Print strings in alphabetical order

I'm trying to do here because the user provides 3 names at least so I have to sort those names alphabetically, I had tried with strcmp , but I did not quite understand the concept of this command. So I used the following code: char nm1[2...
asked by 02.07.2015 / 19:14
2
answers

Find consecutive numbers in a string in C #

I would like to know if there is a simple way to find consecutive (equal) numbers in a string, so that you can replace that string with a single value. For example: string input = "Abc111de2234"; string output = "Abc1de234";     
asked by 16.04.2018 / 21:21
3
answers

Regex to validate a particular date format

I was modifying a regex for a program in c ++ that would validate the following input form of the 29/feb/2000 dates. Currently it was only accepting 29/02/2000 or 30/03/2017 . I tried to add to the other months but I can n...
asked by 29.01.2018 / 11:47
2
answers

Why can I pass a vector of char to the scanf as an address or a direct variable?

If the vector name or array is already the address of the first element, why in scanf() , using the primitive types ( int , char , float , double ) I need to pass the address, and when we want to read a string (...
asked by 02.11.2017 / 15:46