O
O
Orbite2017-11-28 11:57:53
Perl
Orbite, 2017-11-28 11:57:53

How to convert a string to upper case?

How to translate a string with spaces, numbers, dots, commas and other characters from lower case to upper case in Perl? uc($str) doesn't translate

Answer the question

In order to leave comments, you need to log in

4 answer(s)
O
Olgeir, 2017-11-28
@Orbite

To do this, you first need to figure out what encoding the source string is represented in. Where and how do we get it. If it is stupidly indicated in the text, then we look at the encoding of the script itself. If it is read from a file, then you need to look at what encoding the file is in and how we read it.

S
Stimulate, 2017-11-28
@Stimulate

\U$str too?

A
ant2015, 2017-11-28
@ant2015

And if so?
$str =~ tr/az/AZ/;

K
krypt3r, 2017-11-28
@krypt3r

use utf8;
if it does not translate Cyrillic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question