Questions tagged as 'string'

1
answer

Comparison of strings (that match the hours) in javascript is reliable? How it works?

It is well known that in terms of time, that 07:30 is less than 08:30 - speaking in hours. In javascript, if we make this comparison, everything goes as expected above '07:30' < '08:00' // true '08:30' > '09:00' // fals...
asked by 24.08.2015 / 19:14
2
answers

How do I get the first character of a String and make it uppercase by storing it in a variable?

String user,newUser,newPassword, password, resposta, user1,pass1; user = "admin"; password = "123"; Console.WriteLine("LOGIN\n"); body: Console.WriteLine("Ja possui login?"); resposta = Console...
asked by 06.09.2018 / 21:36
2
answers

How to get the host name in URLs?

How to get the name of the host from a URL like Mega, 4shared among others with PHP? In case you would like to know having this URL as an example:    link How can I get from this URL only the word MEGA discarding everything...
asked by 21.01.2015 / 19:17
1
answer

String search with "|" character

I need to perform a query in a txt file in Python, however I have 2 problems due to the interpretation of special characters. When I enter | or \ the result ends up being replaced: | is interrupted as white space and \...
asked by 04.09.2018 / 15:45
1
answer

Capitalize lowercase in string

I need to do a function that takes two strings, and change both of them. But if you have a capital letter at the first, the time to convert must be lowercase. I tried to do it, but I think it's wrong inside my while . What can I do? Not...
asked by 14.06.2018 / 19:29
2
answers

How to print the percentage sign in Python 2/3?

How do I use% after dialing? Ex: print("%d texto texto 10% texto"%var_a)     
asked by 19.01.2018 / 04:20
2
answers

Higher frequency of a string

I have a text where I am handling various things. Now I need to get the 3 words that repeat the most in the entire text. How can I do this? What is the best solution? I thought about storing in a list but I do not know how to put the word and...
asked by 09.09.2014 / 03:11
2
answers

Better performance compared to strings

What is the best performance option? And memory allocation? Use option 1 or 2? String text = "ola mundo"; Option 1: If ( Strings.len(text) > 0 ) {} Option 2: If ( text != "") {}     
asked by 10.03.2018 / 11:54
2
answers

Concatenate sum of number to a string

I want to concatenate a sum from a number to a string in JavaScript and had to resort to an auxiliary variable. What I did first (incorrect example): for (var i; i < x; i++) h = "texto" + x+1 + ".txt"; Then: for (var i; i <...
asked by 27.07.2015 / 15:57
1
answer

How to let the string size be set by scanf ()?

My question is about theory. I know it's possible to do a string without limiting its size as: char teste[] = "Teste"; However, I would like to know if you can do the same thing, that is, not limiting the size, but without saying what...
asked by 23.08.2017 / 19:37