עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

עריכת קובץ טקסט עם #C - החלפת אותיות

Featured Replies

פורסם

שלום אנשים,

אני צריך מעט עזרה עם קוד ב-C# לעריכת טקסט.

הייתי רוצה קוד שיקרא קובץ טקסט שאני יצרתי (להלן -C:\xxxxxx.txt) ולאחר מכן בכל שורה ישנה מספר מסויים לאחר. למשל, שישנה כל ספרה 9 לספרה 8.

אשמח מאוד אם מישהו יוכל לעזור לי בזה. זה בהחלט יקצר לי הרבה תהליכים. אפשר גם שהוא ישמור זאת באותו הקובץ, או שישמור זאת בקובץ חדש (את זה אני כבר יודע לעשות), אבל העיקר שיאכסן את הטקס המתוקן במשתנה כלשהו.

פורסם

מקווה שזה יעזור לך.



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

namespace testing
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
string fileName = @"c:\xxxxxx.txt";
string fileText = File.ReadAllText(fileName);
fileText = fileText.Replace('8', '9');
UTF8Encoding encoder = new UTF8Encoding();
byte[] writeBytes = encoder.GetBytes(fileText);
File.Delete(fileName);
FileStream fs = new FileStream(fileName,FileMode.Create,FileAccess.ReadWrite);
fs.Write(writeBytes,0,writeBytes.Length);
fs.Flush();
fs.Close();


}

}
}

פורסם
  • מחבר

אוקיי תודה בן אדם!

מה שהכי עזר לי זה השימוש בפקודה סגנון:

fileText = fileText.Replace('8', '9');

תודה איש :xyxthumbs:

פורסם

בכיף ;)

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.