Click here to Skip to main content
15,887,683 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Checking OS and Vista admin rights Pin
turkmeistr123-Apr-09 13:03
turkmeistr123-Apr-09 13:03 
GeneralRe: Checking OS and Vista admin rights Pin
turkmeistr123-Apr-09 15:49
turkmeistr123-Apr-09 15:49 
QuestionMarshaling string array to unmanaged code Pin
Oldboy221-Apr-09 22:15
Oldboy221-Apr-09 22:15 
AnswerRe: Marshaling string array to unmanaged code Pin
Mark Salsbery22-Apr-09 6:14
Mark Salsbery22-Apr-09 6:14 
GeneralRe: Marshaling string array to unmanaged code Pin
led mike22-Apr-09 6:27
led mike22-Apr-09 6:27 
GeneralRe: Marshaling string array to unmanaged code Pin
Oldboy222-Apr-09 16:24
Oldboy222-Apr-09 16:24 
GeneralRe: Marshaling string array to unmanaged code Pin
led mike24-Apr-09 4:13
led mike24-Apr-09 4:13 
QuestionQuestions about string manipulation Pin
TabascoSauce20-Apr-09 21:37
TabascoSauce20-Apr-09 21:37 
Hey guys, thanks for looking at my questions!

First off, I am making a program that changes words into pig-latin form, here is an explanation of that: If a words starts with a vowel (including y), simply add -way to the end of the word (ex. "alphabet" would be alphabet-way). If a word starts with a consonant, move the section of the word up till the first vowel and put it at the end with "ay" attatched to it (ex. "lame" would be "ame-lay" and glucose would be "ucose-glay")

On to the questions:

I'm having some trouble figuring out how to determine the length of a word to a vowel. An example would be that the length of the word "Chair" up to the first vowel is 2.

Also, I am having trouble using the String::Compare method to determine if a word even starts with a vowel (see code block at the bottom). I believe the syntax is String::Compare(string1, subscript1, string2, subscript2, count) and it returns a value of 0 if string1 is equivalent to string2, please correct me if I am wrong. I used an array containing all of the vowels and used it as string2 and had the word to compare it it to as string1 with the subscripts and count set up accordingly but it does not seem to return a value as I expected.

Ok, I realize this probably made no sense without any code, so here is what I have so far (problem areas bolded):
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)
         {
             //Variables
             String ^transformy = ""; //User input from text box
             String ^transformed = ""; //Label displaying transformed word
             String ^beginning = ""; //Beginning of transformed word
             String ^end = ""; //End of transformed word
             array<String ^>^vowels = {"a", "e", "i", "o", "u", "y"}; //Vowels
             int VowelOrNot = 0; //See code
             int toVowel = 0; //Distance to first vowel
             int toEnd = 0; //Distance from vowel to end of word

             //Get user input from uIn text box
             transformy = Convert::ToString(uIn->Text);

             //Determine if the first letter is a vowel by comaring the first letter of user input to vowels array
             VowelOrNot = String::Compare(transformy, 0, Convert::ToString(vowels), 0, 1);;
             if (VowelOrNot == 0)
             {
                 //If VowelOrNot says that the first letter is equal, then simply add -way to the end of the word
                 transformed = String::Concat(transformy, "-way");
                 //Output the new word in the pOut Label
                 pOut->Text = Convert::ToString(transformed);
             }
             else
             {
                 //Determine how long a word is up to first vowel
                 toVowel = Something goes here;
                 //Deterimine how long a word is to its end beginning with the first vowel
                 toEnd =  Something also goes here;

                 //Beginning of the word is the rest of the word after the last consonant to the end of the word
                 beginning = transformy->Substring(toVowel, toEnd);

                 //The end of the word is the part of the word before the first vowel + "ay"
                 end = String::Concat(transformy->(0, toVowel), "ay");

                 //Concatenate beginning of the word with - and the end of the word
                 transformed = String::Concat(String::Concat(begining, "-"), end);

                 //Output the new word
                 pOut->Text = Convert::ToString(transformed);
             }

         }


Thank you very much for your time, and any help you can offer!
AnswerRe: Questions about string manipulation [modified] Pin
N a v a n e e t h20-Apr-09 23:19
N a v a n e e t h20-Apr-09 23:19 
GeneralRe: Questions about string manipulation [modified] Pin
TabascoSauce21-Apr-09 15:59
TabascoSauce21-Apr-09 15:59 
QuestionExecuting Code on App Exit Pin
turkmeistr120-Apr-09 9:16
turkmeistr120-Apr-09 9:16 
AnswerRe: Executing Code on App Exit Pin
Luc Pattyn20-Apr-09 9:22
sitebuilderLuc Pattyn20-Apr-09 9:22 
GeneralRe: Executing Code on App Exit Pin
turkmeistr120-Apr-09 9:32
turkmeistr120-Apr-09 9:32 
GeneralRe: Executing Code on App Exit Pin
Luc Pattyn20-Apr-09 9:40
sitebuilderLuc Pattyn20-Apr-09 9:40 
GeneralRe: Executing Code on App Exit Pin
turkmeistr120-Apr-09 10:01
turkmeistr120-Apr-09 10:01 
GeneralRe: Executing Code on App Exit Pin
Luc Pattyn20-Apr-09 10:03
sitebuilderLuc Pattyn20-Apr-09 10:03 
QuestionHow to copy/convert System::Object^(unsigned char) to local variable Pin
marcusab18-Apr-09 10:27
marcusab18-Apr-09 10:27 
AnswerRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
N a v a n e e t h18-Apr-09 16:42
N a v a n e e t h18-Apr-09 16:42 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
marcusab18-Apr-09 23:30
marcusab18-Apr-09 23:30 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
N a v a n e e t h19-Apr-09 6:41
N a v a n e e t h19-Apr-09 6:41 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable [modified] Pin
marcusab19-Apr-09 11:04
marcusab19-Apr-09 11:04 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
N a v a n e e t h19-Apr-09 15:34
N a v a n e e t h19-Apr-09 15:34 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
Luc Pattyn19-Apr-09 16:10
sitebuilderLuc Pattyn19-Apr-09 16:10 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
N a v a n e e t h19-Apr-09 17:02
N a v a n e e t h19-Apr-09 17:02 
GeneralRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
Mark Salsbery20-Apr-09 8:31
Mark Salsbery20-Apr-09 8:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.