Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • pronto 61 posts 172 karma points
    May 20, 2013 @ 12:05
    pronto
    0

    Find character length method

    Hi Everyone,

    Is there a method in Razor to count the number of characters in a string? It seems like such a simple thing but I can't find a solution anywhere.

    Thanks

  • Owen 123 posts 246 karma points
    May 20, 2013 @ 12:18
    Owen
    100

    @("i'm string".Length) - Is this what you want?

  • Fuji Kusaka 2203 posts 4220 karma points
    May 20, 2013 @ 12:40
    Fuji Kusaka
    0

    You can make use of ToString().Length

    So something like 

    @Model.YourProprertAlias.ToString().Length
  • pronto 61 posts 172 karma points
    May 20, 2013 @ 12:42
    pronto
    0

    Thanks guys, that works for me. Damn case sensitivity!

Please Sign in or register to post replies

Write your reply to:

Draft