Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7972765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:56:56+00:00 2026-06-04T07:56:56+00:00

excuse me, i’m trying to make simple application which converting the words into word.

  • 0

excuse me, i’m trying to make simple application which converting the words into word. for example

Enable = able
Payment = Pay

the text on my notepad was “enable payment”

i’m using 2 sample words above, and i’m not getting what i need. i wrote “enable” and “payment” on notepad.txt. then the application will start and get the word.

and the application will start trimming the words cut the “En” and “ment” so their result will be “able” and “pay”

my application can trim the single word “enable” to “able” . and “payment” to “pay” but, the application didn’t work well if i write 2 words or more such as “enable payment” or “payment enable”

here is the user interface image

and here is the source code,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace KTM'
{
public partial class KTM : Form
{
    public string notepad;
    public KTM()
    {
        InitializeComponent();
        textBox1.Enabled=false;
        button2.Enabled = false;
        button3.Enabled = false;
    }

    void enable()
    {
        button2.Enabled = true;
        button3.Enabled = true;
    }
    private void button1_Click(object sender, EventArgs e)
    {

        string dir = Application.StartupPath.ToString();
        OpenFileDialog fdlg = new OpenFileDialog();
        fdlg.Title = "Open *txt files";
        fdlg.InitialDirectory = @dir;
        fdlg.Filter = "Text files (*.txt)|*.txt|Text Files (*.txt)|*.txt";
        fdlg.FilterIndex = 2;
        fdlg.RestoreDirectory = true;
        if (fdlg.ShowDialog() == DialogResult.OK)
        {
            textBox1.Text = fdlg.FileName;
        }
        else
        {

        }


      }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
        if (textBox1.Text.Equals(""))
        {

        }
        else
        {
            enable();
        }
    }

    private void button2_Click(object sender, EventArgs e)
    {
        notepad = textBox1.Text;

        StreamReader sr = new StreamReader(notepad);
        string paragraf = sr.ReadToEnd();
        sr.Close();
        string[] kata = paragraf.Split(' ');
        int i = 0;

        //MessageBox.Show(kata[0]+" "+kata[1]+" "+kata[2]);
        foreach (string ambil in kata)
        {
            if (kata[i].StartsWith("en"))
            {
                kata[i] = kata[i].Substring(2);
            }
            if(kata[i].EndsWith("ment"))
            {
                int len = kata[i].Length;
                int kepake = len - 4;
                kata[i] = kata[i].Substring(0, kepake);
            }


        }
        i++;
        StreamWriter sw = new StreamWriter(notepad);
        i = 0;
        foreach (string ambil in kata)
        {
            sw.Write(kata[i]+" ");
        }
        i++;
        sw.Flush();
        sw.Close();




        MessageBox.Show("Converted and Saved  ","KTM Stemming",MessageBoxButtons.OK,MessageBoxIcon.Information);
    }

    private void button3_Click(object sender, EventArgs e)
    {
        notepad = textBox1.Text;
        System.Diagnostics.Process.Start(notepad);
    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:56:56+00:00Added an answer on June 4, 2026 at 7:56 am
        foreach (string ambil in kata)
        {
            if (kata[i].StartsWith("en"))
            {
                kata[i] = kata[i].Substring(2);
            }
            if(kata[i].EndsWith("ment"))
            {
                int len = kata[i].Length;
                int kepake = len - 4;
                kata[i] = kata[i].Substring(0, kepake);
            }
    
    
        }
    

    this is part of your problem as it is a foreach but you are using it like a for loop. you probably want for (int i=0; i<kata.Length; i++) also you are writting to a file outside of your for loop, so either you need to put your writing in that for loop, or make another for loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Excuse me for my English. I've been trying to create a dynamic table which
excuse me for my ugly english) ! Imagine these very simple models : class
Excuse me if it is a repeat. I have crontab entries which look like:
Excuse my lack of knowledge. Im creating a a php/mysql website which will store
Excuse the rough code, I'm trying to display the duration of videos given the
Please excuse my ignorance on the subject. I would like to write an application
Excuse me, I do not make a clear question in english. I need some
Excuse my ignorance, I'm very new to Python. I'm trying to perform factor analysis
Excuse the beginner level of this question. I have the following simple code, but
Excuse me if my question might seem ignorant. My problem: I'm developing an application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.