අලුත් NIC එකේ Male, Female බලන්නෙ කොහොමද බන්?

CorD SaC

Well-known member
  • Feb 4, 2015
    15,784
    28,162
    113
    අලුත් NIC එකේ Male, Female බලන්නෙ කොහොමද බන්?

    අඩෝ අලුත් NIC එකේ Male,Female බලන ලොජික් එක දන්නෙ කව්ද? අලුත් එකේ අ0ක කීයක් එනවද බන්?


    Updated: එල මචන්ලා, ගොඩ දාගත්තා :) තෑන්ක්ස් කට්ටියටම :love::love::D

    PHP:
            private static string GetGenderByNIC(string nic)
            {
                var male = "Male";
                var female = "Female";
                try
                {
    
                    int d = int.Parse(nic.Substring(4, 3));
                    if (d > 500)
                    {
                        return female;
                    }
                    else
                    {
                        return male;
                    }
                }
                catch (Exception)
                {
    
                    throw;
                }
    
            }
     
    Last edited:
    • Like
    Reactions: wqe123

    CorD SaC

    Well-known member
  • Feb 4, 2015
    15,784
    28,162
    113
    bump. aluth kiwe electronic ekada?

    අනේ මන්දා බන්.හැමොම කියන නිසා මාත් අලුත් කියනවා. :rofl: v & x නෑ කියලත් කියනවා..
     

    mal malli22

    Member
    Sep 19, 2018
    13
    7
    0
    ජොසී;23655323 said:
    Simple.

    OLD NIC: 903290000V
    Third digit in old NIC

    New NIC: 199032900000
    5th Digit in new NIC.

    1990 පිරිමියෙක්ගේ හැදුනුම් පතක් 329 වන දිනේ ඉපදීලා තියෙන්නේ (එම අවුරුද්දේ):yes:
     

    mal malli22

    Member
    Sep 19, 2018
    13
    7
    0
    OLD NIC: 903290000V
    Third digit in old NIC

    New NIC: 199032900000

    මෙම අංකය 500ට වැඩිනම් ගෑනු 500ට අඩුනම් පිරිමි:love:
     
    • Like
    Reactions: CorD SaC

    CorD SaC

    Well-known member
  • Feb 4, 2015
    15,784
    28,162
    113
    ජොසී;23655323 said:
    Simple.

    OLD NIC: 903290000V
    Third digit in old NIC

    New NIC: 199032900000
    5th Digit in new NIC.

    ජොසී;23655329 said:

    පට්ට තෑන්ක්ස් ආ... :love::D
    අඩෝ ඒ සයිට් එක හෙන රිස්කිනේ බන්, කිසි privacy යක් නෑනේ... :lol:


    OLD NIC: 903290000V
    Third digit in old NIC

    New NIC: 199032900000

    මෙම අංකය 500ට වැඩිනම් ගෑනු 500ට අඩුනම් පිරිමි:love:

    :D
     

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,976
    1
    9,797
    113
    Gampaha
    NEW NIC ALGORITHM JAVA 8

    අලුත් NIC එකට පොඩි කෝඩ් කෑල්ල්ක් ලිව්ව. උබලට ඕනෙ විදියට වෙනස් කරගෙන පොඩ්ඩක් ටෙස්ට් කොරල බලල කියපල්ල හරිද කියල. උබලට ඕනෙ ප්‍රොජෙක්ට් වලින් ගෙඩිය පිටින්ම උස්සල පාවිච්චි කරපල්ල. :rofl: JAVA 8 එක්ක මහලොකු වෙලාවක් යන්නෙ නෑ. :D

    Code:
    import java.time.LocalDate;
    import java.time.Period;
    import java.time.temporal.ChronoUnit;
    
    /**
     *
     * @author Tharindu
     */
    public class NicDetails {
    
        private String birthDay, gender, fullAge;
        private int age;
    
        public NicDetails(String nic) {
            setDetails(nic);
        }
    
        public String getBirthDay() {
            return birthDay;
        }
    
        public int getAge() {
            return age;
        }
    
        public String getGender() {
            return gender;
        }
    
        public String getFullAge() {
            return fullAge;
        }
    
        public static void main(String[] args) {
            NicDetails nicDetails = new NicDetails("960621025v");
            System.out.println(nicDetails.getBirthDay());
            System.out.println(nicDetails.getGender());
            System.out.println(nicDetails.getAge());
            System.out.println(nicDetails.getFullAge());
        }
    
        private void setDetails(String nic) {
            int year, days;
            if (nic.length() == 10) {   //OLD NIC-----------------------------------
                year = Integer.parseInt("19" + nic.substring(0, 2));
                days = Integer.parseInt(nic.substring(2, 5));
            } else {                    //NEW NIC-----------------------------------
                year = Integer.parseInt(nic.substring(0, 4));
                days = Integer.parseInt(nic.substring(4, 7));
            }
            if (days > 500) {
                setGender("Female");
                days -= 500;
            } else {
                setGender("Male");
            }
    
            LocalDate date = LocalDate.ofYearDay(year, days);
            if (!date.isLeapYear() && days > 60) {
                date = date.plusDays(-1);
            }
            setBirthDay(date.toString());
    
            //AGE-------------------------------------------------------------------
            int oldYear = (int) ChronoUnit.YEARS.between(date, LocalDate.now());
            setAge(oldYear);
    
            Period elapsed = Period.between(date, LocalDate.now());
    
            String text = oldYear + " years " + elapsed.getMonths() + " month(s) " + elapsed.getDays() + " day(s)";
            setFullAge(text);
    
        }
    
        /**
         * @param birthDay the birthDay to set
         */
        private void setBirthDay(String birthDay) {
            this.birthDay = birthDay;
        }
    
        /**
         * @param gender the gender to set
         */
        private void setGender(String gender) {
            this.gender = gender;
        }
    
        /**
         * @param fullAge the fullAge to set
         */
        private void setFullAge(String fullAge) {
            this.fullAge = fullAge;
        }
    
        /**
         * @param age the age to set
         */
        private void setAge(int age) {
            this.age = age;
        }
    }


    https://en.wikipedia.org/wiki/National_identity_card_(Sri_Lanka)
    :cool::cool:
     

    JVG

    Active member
  • Apr 23, 2009
    377
    25
    28
    kalin wagema thamai neda? wenas une 19 part eka issarahata apu eka withataine. 835896445V kiyala thibunanam aluth eka 19835896445V