Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Smooth Sentences c#

public static bool IsSmooth(string sentence)
{
    sentence = sentence.Trim().ToLower();
    string[] sentences = sentence.Split(' ');

    if (sentence.Length <= 1) return false;

    for (int i = 0; i < sentences.Length - 1; i++)
    {
        string previousWord = sentences[i];
        char lastChar = Char.Parse(previousWord.Substring(previousWord.Length - 1));

        string followingWord = sentences[i + 1];
        char firstChar = Char.Parse(followingWord.Substring(0, 1));

        if (lastChar != firstChar) return false;
    }

    return true;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: stringbuilder sb = new stringbuilder(reallylongstring); you need to identify whether a string stored in an object named stringtofind is within the stringbuilder sb object. 
Csharp :: windows form toolbox enter key 
Csharp :: asp.net core mvc not triggering client side validation 
Csharp :: Area Of the triangle with condition 
Csharp :: button Previous for picturebox c# 
Csharp :: c# convert datatable to csv 
Csharp :: c# string split by length 
Csharp :: c# project 
Csharp :: maximum sum of non-adjacent 
Csharp :: list<string,string c# 
Csharp :: minimum value int C# 
Csharp :: unity destroy 
Csharp :: deserialize list of objects c# 
Csharp :: how to get the index of an element in a list in unity 5 
Csharp :: is c# hard to learn 
Csharp :: unity error cs1656 
Csharp :: how to mirror an image in vs forms 
Csharp :: como guardar archivo en un botón asp.net 
Html :: trademark symbol 
Html :: removing filepath from url using htaccess 
Html :: starting html 
Html :: call link html 
Html :: input acepta solo imagnes 
Html :: add title logo html 
Html :: accepts only audio file in html 
Html :: iframe youtube autoplay not working 
Html :: input datetime 
Html :: how to change font size in html 
Html :: fafa login icons html code 
Html :: html textarea 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =