Questions tagged as 'string'

1
answer

How to insert a statement in the array only if it is true?

I need to somehow check if there is any element within a given array and if it exists, put a string in a specific place. For example:    I need to check if $categoria is not empty $categoria = array($values);   ...
asked by 02.01.2016 / 18:29
1
answer

Some test that this code does not pass [closed]

I'm asking the question Voice Dialing , I've done all the possible tests and I do not find the error could help me in other tests that my code fails My code #include <stdio.h> #include <string.h> #include <ctype.h> int i...
asked by 02.06.2018 / 02:13
3
answers

Replace space with Comma

$var = 123 456 789; I need the value of this variable to be: $var = 123,456,789; Or add a comma after the number: $var = 123, 456, 789; I tried this way: str_replace($var," ","")     
asked by 11.10.2018 / 03:45
2
answers

How to compare only part of a String in Java [closed]

String str = new String("Bruno Oliveira"); String str2 = new String("Gustavo Oliveira"); System.out.println(str.equals(str2)); //retorna false How to compare only a certain part of a string?     
asked by 24.07.2015 / 02:05
2
answers

Create an object reference in its own method

Problem I want to get the last digits of this string , so I used the Substring() method, however I had to use the variable "numero" again within the Substring() method. string numero = "123456789"; string final = numero....
asked by 13.12.2018 / 12:57
1
answer

Program.exe stopped working

I'm doing a program that captures the complete name of a person and reproduces it in this format: surname, name without surname (EX: João Carlos Cunha -> João Cunha, Amanda Batista -> Batista, Amanda). Only the user can type as many names as he...
asked by 16.07.2016 / 14:23
1
answer

Problem with strcpy [duplicate]

I'm trying to fill in the fields of a struct with strcpy but I'm not getting the expected value, such as: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> struct Aluno {...
asked by 28.10.2018 / 20:59
2
answers

Accept only numeric input

nota = -1 while nota < 0 or nota > 10: nota = int(input("Informe a nota entre 0 e 10: ")) if nota < 0 or nota > 10: print("Valor inválido") I need to include in this validation code for, if the user types string (a,...
asked by 09.10.2017 / 21:28
1
answer

How do I accept only letters in the entry in Ruby?

Given a string, you have to take only the uppercase and lowercase letters. And on the output show the same. How can I achieve this?     
asked by 14.08.2018 / 20:45
3
answers

How to replace vowels by @ [closed]

I'm doing a college assignment that asks for a program where the user types the string [20] and I return the inverted string and the vowels replaced by @s. How do I do this?     
asked by 08.12.2017 / 01:12