Questions tagged as 'string'

1
answer

Find all instances of a pattern in a text

I need to write a program that identifies a lowercase letter surrounded by three uppercase letters on each side. For example: "AEIoSDE" == "o" I wrote the code as follows: # coding: utf-8 letra = raw_input() for i in range(1, len(letr...
asked by 15.08.2014 / 18:15
2
answers

How to convert a std :: string into a QString?

I'm trying to make a simple display my name dialog box. See the code. Pessoa *p = new Pessoa("Ronald Araújo", "[email protected]", 23); QMessageBox msg; msg.setText(QString::fromUtf8(p->getNome())); msg.exec(); But the code bre...
asked by 18.06.2014 / 00:21
2
answers

Picking characters uniquely in a multiple string

Hello, I need a help for a regular expression that satisfies some occurrences of a text file. In this case, I need a regular expression that finds occurrences where there are a minimum number of characters in a pattern. For example: I have...
asked by 18.03.2014 / 17:40
2
answers

Strings Comparison

There are several ways of comparison, but I always see that the most indicated are ( ===, strcmp ou strcasecmp ). Among these forms considered the safest (according to some websites), the following doubts follow: Which would be the...
asked by 02.04.2015 / 14:50
2
answers

How to find a reserved word in a sentence?

I'm creating a routine to search for reserved words in a text (people's names). I have already tested with Contains() and IndexOf() . It works well most of the time. However in some words the return does not satisfy. Example: CORAL...
asked by 01.11.2017 / 17:50
1
answer

How do I save an undefined string in a structure?

#include <stdio.h> #include <stdlib.h> #include <string.h> struct Ecoponto{ int codigo; int contentores[3]; char cidade[20]; char *rua; int nporta; }; int main(int argc, char** argv) { struct Ecoponto ecop...
asked by 05.01.2017 / 21:14
3
answers

How to replace a given string inside another Javascript string?

How can I replace only a certain part of a string ? Example: var linha_nova = "EU TENHO UM CACHORRO"; I want to replace only the word "UM" with another. How should I proceed? I also need to replace with the known position of the...
asked by 24.05.2014 / 20:10
2
answers

Alternative to create a new method on a String object?

I have the following situation: I have a txt file of defined positions (type CSV, CNAB, etc.) to process and extract values. For purposes of understanding, follow the code I've made and it's working perfectly: public class Extract { final...
asked by 17.03.2015 / 16:18
4
answers

How to split a string into specific sizes in JavaScript?

I need to split a string into a specific size in JavaScript. I know you can use Join to turn a string into a array of letters: 'hello'.split('') However, I need a way where I can determine the size at which this st...
asked by 11.08.2016 / 14:59
5
answers

Remove part of a string

I have a string, example: 32137hyb8bhbhu837218nhbuhuh&3298j19j2n39 I want to remove (clean) from the string everything that comes after & . Please, how to do this?     
asked by 26.01.2017 / 05:23