Users Pricing

forum

home / developersection / forums / get sub string from a string in mvc

Get sub string from a string in MVC

Anonymous User 1451 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.


I am a content writter !


1 Answers