Skip to content

Naveen-Main #78 #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions textutils/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# I have created this file - Harry
# I have created this file - Harry (IITian)
from django.http import HttpResponse
from django.shortcuts import render

Expand All @@ -25,15 +25,15 @@ def analyze(request):
for char in djtext:
if char not in punctuations:
analyzed = analyzed + char

purp = "Removed Punctuations"
params = {'purpose':'Removed Punctuations', 'analyzed_text': analyzed}
djtext = analyzed

if(fullcaps=="on"):
analyzed = ""
for char in djtext:
analyzed = analyzed + char.upper()

purp += " | Changed To Uppercase"
params = {'purpose': 'Changed to Uppercase', 'analyzed_text': analyzed}
djtext = analyzed

Expand All @@ -47,7 +47,7 @@ def analyze(request):

elif not(djtext[index] == " " and djtext[index+1]==" "):
analyzed = analyzed + char

purp += " | Extra Space Removed"
params = {'purpose': 'Removed NewLines', 'analyzed_text': analyzed}
djtext = analyzed

Expand All @@ -56,7 +56,7 @@ def analyze(request):
for char in djtext:
if char != "\n" and char!="\r":
analyzed = analyzed + char

purp += " | New Line Removed"
params = {'purpose': 'Removed NewLines', 'analyzed_text': analyzed}

if (numberremover == "on"):
Expand All @@ -66,15 +66,16 @@ def analyze(request):
for char in djtext:
if char not in numbers:
analyzed = analyzed + char

purp += " | Number Removed"
params = {'purpose': 'Removed NewLines', 'analyzed_text': analyzed}
djtext = analyzed


if(removepunc != "on" and newlineremover!="on" and extraspaceremover!="on" and fullcaps!="on" and numberremover != "on"):
return HttpResponse("please select any operation and try again")

return render(request, 'analyze.html', params)
Parameters = {'purpose':purp,'analyzed_text':analyzed }
return render(request, 'analyze.html', Parameters)

def about(request):
return render(request, 'about.html')