עבור לתוכן
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.

הסרת תווים לא רצויים מתוך string ב c#

Featured Replies

פורסם

אני רוצה להסיר את כל התווים מ string שלא נמצאים בתוך מערך char.

לדוגמה יש לי דבר כזה:

string userInput = "abcaa/1%2ascds24%)";
char[] goodChars= {'a', 'b', 'c', 'd'};

אני רוצה להסיר מ userInput את כל התווים שלא נמצאים ב- goodChars.

יש דרך פשוטה ומהירה לעשות את זה?

פורסם

הכי פשוט זה להשתמש בספרייה המובנת של REGULAR EXPRESSION, הבעיה היא שצריך ללמוד להכיר אותה.

פורסם
  • מחבר

אני רואה ה regular expressions תופס אותי לא משנה מה אני עושה... נראה שהגיע הזמן ללמוד מה זה :P

בסופו של דבר אילתרתי משהו עם שני לולאות.

עשיתי לולאה שתעבור על כל התווים ב string ואז בתוכה עוד לולאה שתבדוק את התו המסויים אם הוא קיים במערך.

בטח זה לא הדבר הכי יעיל שאפשר לעשות, אבל זה מה שקורה כשהידע שלך מוגבל :)

תודה...

ארכיון

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

דיונים חדשים

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.