Virksomheder er på vej fra store sprogmodeller, der svarer på spørgsmål, til AI-agenter, der kan udføre opgaver på egen hånd. Det gør teknologien mere nyttig – og langt mere risikabel.
using System; using System.Text.RegularExpressions;
namespace E3 { public class MainClass { public static Regex c = new Regex("/\\*.*?\\*/", RegexOptions.Singleline); public static Regex cpp = new Regex("//.*?\r\n"); public static string StripComments(string s) { return c.Replace(cpp.Replace(s, "\r\n"), ""); } public static void Main(string[] args) { string s = @"myobj* hat = new myobj(); //ny ting /* Husk at slette engang */ funccall( /* første parameter er en hat */ hat, nogetandet); delete hat;"; Console.WriteLine(StripComments(s)); } } }
En smule anderledes, men ellers stort set samme løsningsmodel:
using System; using System.Text.RegularExpressions;
namespace e717968 { public class MainClass { public static Regex c1 = new Regex(@"\s*//.*"); public static Regex c2 = new Regex(@"/\*.*?\*/(\s*\r\n)?", RegexOptions.Singleline);
public static void Main(string[] args) { string s = @"myobj* hat = new myobj(); //ny ting /* Husk at slette engang */ funccall( /* første parameter er en hat */ hat, nogetandet); delete hat;"; Console.WriteLine(StripComments(s)); } } }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.