The current feature allows two cases for letters; lower letters and upper/capital letters. Sometimes the variable captures three names or two words where you need the initials with capital letters, example Andrew Raphael,....Letters A and R (initials) are capital. This feature is missing
If there is alternative solution kindly help, i find it difficult for data entrants switching cases in keyboard
Why not just tell the enumerators to use all lower case or all upper case? You can convert to mixed in case in logic if you really need it although in many cases it is not needed. To convert to mixed case just have a loop through the string and each time you find a space you capitalize the next letter.
Try Googling "capitalize first character of each word in string". That will show you some examples in other programming languages that you can adapt to CSPro.
#include <stdio.h>
#define MAX 100
int main()
{
char str[MAX]={0};
int i;
//input string
printf("Enter a string: ");
scanf("%[^\n]s",str); //read string with spaces
//capitalize first character of words
for(i=0; str[i]!='\0'; i++)
{
//check first character is lowercase alphabet
if(i==0)
{
if((str[i]>='a' && str[i]<='z'))
str[i]=str[i]-32; //subtract 32 to make it capital
continue; //continue to the loop
}
if(str[i]==' ')//check space
{
//if space is found, check next character
++i;
//check next character is lowercase alphabet
if(str[i]>='a' && str[i]<='z')
{
str[i]=str[i]-32; //subtract 32 to make it capital
continue; //continue to the loop
}
}
else
{
//all other uppercase characters should be in lowercase
if(str[i]>='A' && str[i]<='Z')
str[i]=str[i]+32; //subtract 32 to make it small/lowercase
}
}
printf("Capitalize string is: %s\n",str);
return 0;
}
And it seem difficult to port it to Cspro Programming Language... I can't "translate" #define MAX 100
scanf("%[^\n]s",str); //read string with spaces
char str[MAX]={0};
str!='\0';
Please can you help us?
In the future when we can use C/C++ functions/methods/classes inside Cspro Logic, this will open an univers for Csprousers.