Str is probably a String variable declared. Usually when we declare String objects we prefix it with the character str. example: String strName = "";
As of Java 1.6 it has 3: StringTokenizer(String str) StringTokenizer(String str, String delim) StringTokenizer(String str, String delim, boolean returnDelims)
Use for loop declare string array str[] and string variable l= string length of string array j=l for i=0 to i=l/2 then temp=str[i] str[i]=str[j-1] str[j-1]=temp j=j-1 now print str array it will be reversed
Str converts a number to a string.
main(){ char str[5]="hello"; if(str==NULL) printf("string null"); else printf("string not null"); }
#include<stdio.h> int main() { char str[100]; int i; printf("Please enter a string: "); // gets(str); // fgets is a better option over gets to read multiword string . fgets(str, 100, stdin); // Following can be added for extra precaution for '\n' character // if(str[length(str)-1] == '\n') str[strlen(str)-1]=NULL; for(i=0;str[i]!=NULL;i++) { if(str[i]>='A'&&str[i]<='Z') str[i]+=32; else if(str[i]>='a'&&str[i]<='z') str[i]-=32; } printf("String in toggle case is: %s",str); return 0; }
#include <string> #include <iostream> using namespace::std; ... string str = "This is a test"; cout << str << endl; str = "This is also a test"; cout << str << endl; Gives you ... This is a test This is also a test
String itself is an object dude... If you want an object out of a string then you can do this. Object obj = (Object) str; //str is the String you want to convert to object.
#include<stdio.h> #include<conio.h> #include<string.h> int main() { int tmp,i; char str[30]; printf("Enter any string: "); gets(str); for(i=0; str[i]!='\0'; i++) { if(str[i-1]==' ' i==0) { if(str[i]>='a' && str[i]<='z') str[i]=str[i]-32; else if(str[i]>='A' && str[i]<='Z') str[i]=str[i]+32; } printf("%c",str[i]); } getch(); return 0;}
[ string toupper $str ] or [ string tolower $str ]
(strlen(str) == 0) ? '\0' : str[strlen(str)-1]
main(){ char str[5]="hello"; if(str==NULL) printf("string null"); else printf("string not null"); }
RemoveSpaces (char *str) { char *new = str; while (*str != '\0') { if (*str != ' ') *(new++) = *str; str++; } *new = '\0'; }