Get File Postfix Str - CSharp System.IO

CSharp examples for System.IO:File Path

Description

Get File Postfix Str

Demo Code


using System.IO;//from  w  ww. jav  a 2s  .  c  o  m
using System;

public class Main{

        public static string GetPostfixStr(string filename)
        {
            int start = filename.LastIndexOf(".");
            int length = filename.Length;
            string postfix = filename.Substring(start, length - start);
            return postfix;
        }
}

Related Tutorials