forum

Home / DeveloperSection / Forums / Get sub string from a string in MVC

Get sub string from a string in MVC

Anonymous User 1071 15-Dec-2017

Hi,

I have faced some issue with my code. I want to show only 10 characters from my string.

Here is my code.

<span style="font-size: medium">

                            @if (item.Name.Length > 10)
                            {
                                @item.Name.ToString(); // Here i want to show only 10 characters.
                            }
                            else
                            {
                                @item.Name.ToString();
                            }
                        </span>

Please give me some idea to accomplish my task.



Updated on 15-Dec-2017
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By