Difference between revisions of "ReNamer:Pascal Script:WideUpperCase"

From den4b Wiki
Jump to navigation Jump to search
(Categorised)
m (Text replacement - "<source>" to "<syntaxhighlight lang="pascal">")
Line 8: Line 8:
 
First, we will uppercase the filename and lowercase the extention. We will use '''WideUpperCase''' and '''WideLowerCase''' functions that take a string as a parameter and return that string in proper case.
 
First, we will uppercase the filename and lowercase the extention. We will use '''WideUpperCase''' and '''WideLowerCase''' functions that take a string as a parameter and return that string in proper case.
  
<source>
+
<syntaxhighlight lang="pascal">
 
FileName := WideUpperCase(WideExtractBaseName(FileName))
 
FileName := WideUpperCase(WideExtractBaseName(FileName))
 
   + WideLowerCase(WideExtractFileExt(FileName));
 
   + WideLowerCase(WideExtractFileExt(FileName));
Line 16: Line 16:
 
We can also capitalize every word with '''WideCaseCapitalize''' function:
 
We can also capitalize every word with '''WideCaseCapitalize''' function:
  
<source>
+
<syntaxhighlight lang="pascal">
 
FileName := WideCaseCapitalize(WideExtractBaseName(FileName)) +
 
FileName := WideCaseCapitalize(WideExtractBaseName(FileName)) +
 
   WideExtractFileExt(FileName);
 
   WideExtractFileExt(FileName);
Line 24: Line 24:
 
For inverting case we will use '''WideCaseInvert''' function:
 
For inverting case we will use '''WideCaseInvert''' function:
  
<source>
+
<syntaxhighlight lang="pascal">
 
FileName := WideCaseInvert(FileName);
 
FileName := WideCaseInvert(FileName);
 
</source>
 
</source>

Revision as of 16:01, 8 February 2017

WideUpperCase or How to uppercase the filename

In this chapter we will learn how to achieve goals similar to the Case rule.

UPPERCASE and lowercase

First, we will uppercase the filename and lowercase the extention. We will use WideUpperCase and WideLowerCase functions that take a string as a parameter and return that string in proper case.

<syntaxhighlight lang="pascal"> FileName := WideUpperCase(WideExtractBaseName(FileName))

 + WideLowerCase(WideExtractFileExt(FileName));

</source>

Capitalize Every Word

We can also capitalize every word with WideCaseCapitalize function:

<syntaxhighlight lang="pascal"> FileName := WideCaseCapitalize(WideExtractBaseName(FileName)) +

 WideExtractFileExt(FileName);

</source>

iNVERT cASE

For inverting case we will use WideCaseInvert function:

<syntaxhighlight lang="pascal"> FileName := WideCaseInvert(FileName); </source>

First letter capital

Making only first letter capital is a bit more complex and will be described in the next chapter.