Questions tagged as 'string'

5
answers

Should I check dates with DateTime or regex?

I've seen two different ways to check if a date is valid. In a "modern" way, with DateTime : $date="2014-02-04"; $dt = DateTime::createFromFormat("Y-m-d", $date); return $dt !== false && !array_sum($dt->getLastErrors());...
asked by 04.02.2014 / 19:42
2
answers

What is the way to truncate a string in Csharp?

I have a scenario where I have set the maximum size of a field. I want to cut this value to the limit. I'm doing this through Substring , but it returns an error when I have a smaller-sized character. Example: int limite = 20; string...
asked by 07.12.2017 / 16:25
3
answers

Verify that you have more than one character in a String

How can I check how many "@" has in a String? example:    "@ Testing" It has 2 @ , how can I do this check in java?     
asked by 07.03.2017 / 01:29
3
answers

Template String in JavaScript

I'm having trouble making a function in JavaScript that I pass a string and an object and it fills this string with the attributes of that object, for example: var user = { nome: “danilo”, idade: 29 }; var a = “Meu nome é ${nome}, e t...
asked by 07.08.2015 / 20:37
2
answers

Replace in SQL - Character to keep a piece of text

I need to modify a part in the text of a table. The records for an email are [email protected] and need to change all to jf.jus.br . Only the first part of the email does not change (the xxx). I can do one update TABELA set email = RE...
asked by 19.08.2014 / 17:08
2
answers

How to get multiple groups in a Regex?

public string site = "http://www.tibia.com/community/?subtopic=worlds&world=Aurera"; private Regex nomedochar = new Regex("subtopic=characters&name=(?<player>.*?)\" >"); public string nomedochar2 = ""; public Thre...
asked by 20.04.2014 / 07:33
4
answers

How to test the condition on a vector?

I have to do a program that reads a text, where each first letter of each word of the text is replaced by a character (*). I can not compile correctly, I believe the problem is in my condition ( if ). #include <stdlib.h> #include &...
asked by 21.09.2015 / 00:37
1
answer

Function to generate random alphanumeric characters

I need a C # function that generates a String of random alphabetic and numeric characters of size N .     
asked by 01.09.2015 / 21:38
1
answer

Whenever I'm scanning a string in C I should use "strlen ()", right?

It is common to see in C executions that people need to parse and / or manipulate the contents of a string , so we need to be sure that it will not exceed its limit. It is very common to make a for ranging from 0 to strlen() - 1 ,...
asked by 24.11.2016 / 12:53
4
answers

How to search recursively using grep

How to search for a certain word recursively in all files in the current directory and its subdirectories? I tried to navigate with: find . | grep "palavra"     
asked by 26.03.2014 / 14:17